common

package
v0.0.0-...-b2c1117 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CanceledError = errors.New("ctx has canceled")
)
View Source
var (
	GlobalLogger *zap.SugaredLogger
)
View Source
var (
	ProjectName = "gargantua"
)

ProjectName todo: change some into const

Functions

func LoggerInjectTrigger

func LoggerInjectTrigger(_ *zap.SugaredLogger)

LoggerInjectTrigger make dig framework initiate logger immediately

func NewLogger

func NewLogger(pConfig *ProjectConfig) *zap.SugaredLogger

func SetConfigPath

func SetConfigPath(path string)

Types

type EnvType

type EnvType string
var (
	ProductEnv EnvType = "product"
	DevelopEnv EnvType = "develop"
)

type GrpcConfig

type GrpcConfig struct {
	Network string `yaml:"network"`
	Host    string `yaml:"host"`
	Port    int    `yaml:"port"`
}

type LogConfig

type LogConfig struct {
	EnvType    EnvType  `yaml:"env_type"`
	OutputPath []string `yaml:"output_path"`
}

type ProjectConfig

type ProjectConfig struct {
	Log  LogConfig  `yaml:"log"`
	Grpc GrpcConfig `yaml:"grpc"`
	Rest RestConfig `yaml:"rest"`
}

func NewConfig

func NewConfig() (*ProjectConfig, error)

type RestConfig

type RestConfig struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

Jump to

Keyboard shortcuts

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