config

package
v0.0.0-...-9495e6b Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MySQL  MySQL
	Hertz  Hertz
	JWT    JWT
	Upload Upload
	Redis  Redis
	Zap    Zap
}

type Hertz

type Hertz struct {
	Host string `mapstructure:"host" json:"host" yaml:"host"` // Hertz服务器地址
	Port string `mapstructure:"port" json:"port" yaml:"port"` // Hertz服务器端口
}

func (*Hertz) WithHostPorts

func (h *Hertz) WithHostPorts() string

type JWT

type JWT struct {
	SigningKey  string `mapstructure:"signing-key" json:"signing-key" yaml:"signing-key"`    // jwt签名
	ExpiresTime string `mapstructure:"expires-time" json:"expires-time" yaml:"expires-time"` // 过期时间
	BufferTime  string `mapstructure:"buffer-time" json:"buffer-time" yaml:"buffer-time"`    // 缓冲时间
	Issuer      string `mapstructure:"issuer" json:"issuer" yaml:"issuer"`                   // 签发者
}

type MySQL

type MySQL struct {
	Host     string `mapstructure:"host" json:"host" yaml:"host"`             // 数据库地址
	Port     string `mapstructure:"port" json:"port" yaml:"port"`             // 数据库端口
	DBName   string `mapstructure:"db_name" json:"db_name" yaml:"db_name"`    // 数据库名
	Username string `mapstructure:"username" json:"username" yaml:"username"` // 数据库连接登录名
	Password string `mapstructure:"password" json:"password" yaml:"password"` // 数据库连接密码
	Config   string `mapstructure:"config" json:"config" yaml:"config"`       // DSN配置信息
}

func (*MySQL) DSN

func (m *MySQL) DSN() string

*

type Redis

type Redis struct {
	Host     string `mapstructure:"host" json:"host" yaml:"host"`
	Port     string `mapstructure:"port" json:"port" yaml:"port"`
	Password string `mapstructure:"password" json:"password" yaml:"password"`
	DB       int    `mapstructure:"db" json:"db" yaml:"db"`
}

func (*Redis) Addr

func (r *Redis) Addr() string

type Upload

type Upload struct {
	PublicHost string `mapstructure:"public_host" json:"public_host" yaml:"public_host"`
	PublicPort string `mapstructure:"public_port" json:"public_port" yaml:"public_port"`
	UploadRoot string `mapstructure:"upload_root" json:"upload_root" yaml:"upload_root"`
}

type Zap

type Zap struct {
	Level         string `mapstructure:"level" json:"level" yaml:"level"`                            // 级别
	Prefix        string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`                         // 日志前缀
	Format        string `mapstructure:"format" json:"format" yaml:"format"`                         // 输出
	Director      string `mapstructure:"director" json:"director"  yaml:"director"`                  // 日志文件夹
	EncodeLevel   string `mapstructure:"encode-level" json:"encode-level" yaml:"encode-level"`       // 编码级
	StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktrace-key" yaml:"stacktrace-key"` // 栈名

	MaxAge       int  `mapstructure:"max-age" json:"max-age" yaml:"max-age"`                      // 日志留存时间
	ShowLine     bool `mapstructure:"show-line" json:"show-line" yaml:"show-line"`                // 显示行
	LogInConsole bool `mapstructure:"log-in-console" json:"log-in-console" yaml:"log-in-console"` // 输出控制台
}

func (*Zap) TransportLevel

func (z *Zap) TransportLevel() zapcore.Level

TransportLevel 根据字符串转化为 zapcore.Level Author [SliverHorn](https://github.com/SliverHorn)

func (*Zap) ZapEncodeLevel

func (z *Zap) ZapEncodeLevel() zapcore.LevelEncoder

ZapEncodeLevel 根据 EncodeLevel 返回 zapcore.LevelEncoder Author [SliverHorn](https://github.com/SliverHorn)

Jump to

Keyboard shortcuts

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