utils

package
v0.0.0-...-c38fcd0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Name is the name of the compiled software.
	Name string
	// Version is the version of the compiled software.
	Version string
)

go build -ldflags "-X main.Version=x.y.z"

Functions

func EnsureDir

func EnsureDir(dirName string) error

EnsureDir 确保路径存在

func Get

func Get[T any](m *DependencyManager, t T) T

func GetAbbr

func GetAbbr(name string) string

func GetConfig

func GetConfig() *conf.Bootstrap

func GetEnv

func GetEnv() (string, string, string)

func GetID

func GetID(id string) int64

func GetIDList

func GetIDList(idList []string) []int64

func GetIDString

func GetIDString(id int64) string

func GetLogger

func GetLogger() *zap.Logger

func ResetLogger

func ResetLogger()

Types

type DependencyManager

type DependencyManager struct {
	Store    map[reflect.Type]any
	FuncStor map[reflect.Type]RegisterFunc
}

func (*DependencyManager) Register

func (d *DependencyManager) Register(registerType any, f RegisterFunc)

type RegisterFunc

type RegisterFunc func() any

type ZapLogger

type ZapLogger struct {
	Sync func() error
	// contains filtered or unexported fields
}

ZapLogger is a logger impl.

func GetZapLogger

func GetZapLogger() *ZapLogger

NewZapLogger return a zap logger.

func (*ZapLogger) Log

func (l *ZapLogger) Log(level log.Level, keyvals ...interface{}) error

Log Implementation of logger interface.

Directories

Path Synopsis
request

Jump to

Keyboard shortcuts

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