common

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfigFormatNotSupported = customerrors.BAD_REQUEST_ERROR("config format not supported, Expect one of json, yaml")
	ErrInvalidConfigReaderName  = customerrors.BAD_REQUEST_ERROR("invalid config reader name, Expect one of consul, zookeeper, database, file")
	ErrInvalidConfig            = customerrors.BAD_REQUEST_ERROR("invalid config")
)

Functions

func Marshal

func Marshal(conf any, cft ...ConfigFormatType) ([]byte, error)

func Unmarshal

func Unmarshal(data []byte, conf any, cft ...ConfigFormatType) error

Unmarshal unmarshals the data into the given config object. It supports json and yaml formats. If no format is provided, it defaults to yaml.

Types

type ConfigFormatType

type ConfigFormatType string

ConfigFormatType represents the type of config format.

const (
	ConfigFormatJSON ConfigFormatType = "json"
	ConfigFormatYAML ConfigFormatType = "yaml"
)

type ConfigReaderName

type ConfigReaderName string

ConfigReaderName represents the type of config reader.

const (
	ConsulConfigReader    ConfigReaderName = "consul"
	ZookeeperConfigReader ConfigReaderName = "zookeeper"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL