config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckConfig

func CheckConfig(conf *ErrCodeConfig)

func MustInit

func MustInit(configFile string)

func ParseModuleConfig

func ParseModuleConfig() error

func PatchConfig

func PatchConfig(conf *ErrCodeConfig)

func PatchModules

func PatchModules(modules []ErrCodeModuleConfig)

Types

type ErrCodeCommonConfig

type ErrCodeCommonConfig struct {
	PkgName          string `json:"pkg_name"`
	ClientCodePrefix string `json:"client_code_prefix"`
	ServerCodePrefix string `json:"server_code_prefix"`
	AppCode          string `json:"app_code"`
	NewErrorFuncPkg  string `json:"new_error_func_pkg"` // pkg like fmt or errors
	NewErrorFunc     string `json:"new_error_func"`     // func like `New` from errors or `Errorf` from fmt
}

type ErrCodeConfig

type ErrCodeConfig struct {
	ErrCodeCommonConfig
	Modules []ErrCodeModuleConfig `json:"modules"`
}

func GetConfig

func GetConfig() *ErrCodeConfig

type ErrCodeModuleConfig

type ErrCodeModuleConfig struct {
	ModuleName  string                  `json:"module_name"`
	ModuleCode  string                  `json:"module_code"`
	ClientCodes []ErrCodeVariableConfig `json:"client_codes"`
	ServerCodes []ErrCodeVariableConfig `json:"server_codes"`
}

type ErrCodeVariableConfig

type ErrCodeVariableConfig struct {
	Name      string `json:"name"`
	ErrNumber string `json:"err_number"`
	Msg       string `json:"msg"`
}

Jump to

Keyboard shortcuts

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