common

package
v0.0.0-...-a5c2be1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeBadParam         = 10001
	ErrCodeUserNotFound     = 10100
	ErrCodeInvalidPassword  = 10101
	ErrCodePermissionDenied = 10201
	ErrCodeUnauthorized     = 10202
	ErrCodeServiceBusy      = 20001
	ErrCodeNotFound         = 40400
)

Variables

View Source
var Log = &Logger{Logger: logging.MustGetLogger("om")}

Functions

func GetAddr

func GetAddr() string

func GetEnv

func GetEnv() string

func InitConfig

func InitConfig(cfgFile string) error

func InitLog

func InitLog()

Types

type Casbin

type Casbin struct {
	Enable bool `json:"enable"`
}

func GetCasbin

func GetCasbin() Casbin

type Config

type Config struct {
	Env    string       `json:"env"`
	Addr   string       `json:"addr"`
	Mysql  *MysqlConfig `json:"mysql"`
	Casbin Casbin       `json:"casbin"`
}

type Logger

type Logger struct {
	*logging.Logger
}

func (*Logger) Log

func (l *Logger) Log(v ...interface{})

func (*Logger) Logf

func (l *Logger) Logf(format string, v ...interface{})

func (*Logger) Print

func (l *Logger) Print(v ...interface{})

给sql用

type MysqlConfig

type MysqlConfig struct {
	Addr     string `json:"addr"`
	User     string `json:"user"`
	Password string `json:"password"`
	Db       string `json:"db"`
}

func GetMysqlCfg

func GetMysqlCfg() *MysqlConfig

Jump to

Keyboard shortcuts

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