runtime

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConfig

func InitConfig(filename string) error

InitConfig 初始化配置

Types

type Config

type Config struct {
	AppName    string     `yaml:"AppName"`
	Port       string     `yaml:"Port"`
	DataSource DataSource `yaml:"DataSource"`
	Redis      RedisCfg   `yaml:"Redis"`
	Jwt        JwtCfg     `yaml:"Jwt"`
	Log        LogCfg     `yaml:"Log"`
}
var Setting Config // 配置(全局变量)

func (Config) String

func (c Config) String() string

type DataSource

type DataSource struct {
	Driver string `yaml:"Driver"`
	DSN    string `yaml:"DSN"`
}

DataSource 数据库

type JwtCfg

type JwtCfg struct {
	Secret string `yaml:"Secret"`
	Expire int    `yaml:"Expire"` // 过期时间
}

type LogCfg

type LogCfg struct {
	Path     string // 日志文件目录, 为空时打印到控制台
	Level    string // 日志级别debug、info、warn、error
	ShowSQL  bool   // 是否打印sql语句
	Interval int    // 日志切割时间间隔, 单位:h
}

LogCfg 日志配置

type RedisCfg

type RedisCfg struct {
	Addr      string `yaml:"Addr"`
	MaxActive int    `yaml:"MaxActive"`
	Username  string `yaml:"Username"`
	Password  string `yaml:"Password"`
}

RedisCfg Redis配置

Jump to

Keyboard shortcuts

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