config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultConfig

func GetDefaultConfig() (string, error)

Types

type DefaultConfigTpl

type DefaultConfigTpl struct {
	JwtSecurity string
}

DefaultConfigTpl store template data.

type Dialog

type Dialog struct {
	OpInterval     time.Duration `yaml:"opInterval" json:"opInterval,omitempty"`         // Interval for sending op messages
	IdleInterval   time.Duration `yaml:"idleInterval" json:"idleInterval,omitempty"`     // Interval for inserting system time in the session list
	SessionExpire  time.Duration `yaml:"sessionExpire" json:"sessionExpire,omitempty"`   // Session expiration duration
	GuardInterval  time.Duration `yaml:"guardInterval" json:"guardInterval,omitempty"`   // Scan interval duration
	AssignInterval time.Duration `yaml:"assignInterval" json:"assignInterval,omitempty"` // Assignment interval time
}

type Logger

type Logger struct {
	LogFile        string
	RuntimeLogFile string

	LogPath    string `yaml:"logPath"`    // Path of the log file
	MaxSize    int    `yaml:"maxSize"`    // Maximum log file size in MB
	MaxBackups int    `yaml:"maxBackups"` // Maximum number of log file backups
	MaxAge     int    `yaml:"maxAge"`     // Maximum number of days to retain log files
	Compress   bool   `yaml:"compress"`   // Whether to enable gzip compression
	UseCaller  bool   `yaml:"useCaller"`  // Whether to enable Zap Caller
}

func (*Logger) GetEncoder

func (config *Logger) GetEncoder(mode string) zapcore.Encoder

GetEncoder 根据模式获取编码器

type MySQL

type MySQL struct {
	Host          string        `yaml:"host" json:"host"`
	Port          int           `yaml:"port" json:"port"`
	User          string        `yaml:"user" json:"user"`
	Password      string        `yaml:"password" json:"password"`
	Database      string        `yaml:"database" json:"database"`
	Prefix        string        `yaml:"prefix" json:"prefix"`
	LogLevel      int           `yaml:"logLevel"`
	Idle          int           `yaml:"idle" json:"idle"`
	IdleTime      time.Duration `yaml:"idleTime" json:"idleTime,omitempty"`
	MaxLifetime   time.Duration `yaml:"maxLifetime" json:"maxLifetime,omitempty"`     // Maximum time a connection can be reused
	HeartBeatTime time.Duration `yaml:"heartBeatTime" json:"heartBeatTime,omitempty"` // Heartbeat check time for MySQL server connections
	Active        int           `yaml:"active" json:"active"`                         // Active connections
	MaxOpen       int           `yaml:"maxOpen" json:"maxOpen"`                       // Maximum open connections
	Enable        int           `yaml:"enable" json:"enable"`                         // 0, disabled; 1, enabled

	AutoMigrateTables bool // Whether to synchronize table structures
}

func (*MySQL) GetDsn

func (dbc *MySQL) GetDsn() string

type Redis

type Redis struct {
	Addr         string        `yaml:"addr" json:"addr"`
	Username     string        `yaml:"username" json:"username"`
	Pwd          string        `yaml:"pwd" json:"pwd"`
	Db           int           `yaml:"db" json:"db"`
	LogLevel     int           `yaml:"logLevel"`
	MinIdleConns int           `yaml:"minIdleConns" json:"minIdleConns"`         // Minimum number of idle connections, useful when establishing new connections is slow.
	IdleTimeout  time.Duration `yaml:"idleTimeout" json:"idleTimeout,omitempty"` // Time after which idle connections are closed by the client, default is 5 minutes, -1 disables the setting.
}

type SqlServer

type SqlServer struct {
	Host                   string        `yaml:"host"`
	Port                   int           `yaml:"port"`
	User                   string        `yaml:"user"`
	Pwd                    string        `yaml:"pwd"`
	Database               string        `yaml:"database"`
	Prefix                 string        `yaml:"prefix"`
	Encrypt                string        `yaml:"encrypt"`
	LogLevel               int           `yaml:"logLevel"`
	TrustServerCertificate string        `yaml:"trustServerCertificate"`
	Idle                   int           `yaml:"idle"`
	IdleTime               time.Duration `yaml:"idleTime"`
	MaxLifetime            time.Duration `yaml:"maxLifetime"` // Maximum time a connection can be reused
	MaxOpen                int           `yaml:"maxOpen"`
}

func (*SqlServer) GetDsn

func (m *SqlServer) GetDsn() string

type Sqlite

type Sqlite struct {
	Database        string        `yaml:"database"`        // Path to the database file
	Prefix          string        `yaml:"prefix"`          // Table prefix
	MaxIdleConns    int           `yaml:"maxIdleConns"`    // Maximum number of idle connections in the pool
	MaxOpenConns    int           `yaml:"maxOpenConns"`    // Maximum number of open connections to the database
	LogLevel        int           `yaml:"logLevel"`        // Log level
	ConnMaxLifetime time.Duration `yaml:"connMaxLifetime"` // Maximum lifetime of connections
}

Jump to

Keyboard shortcuts

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