options

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTOptions added in v0.2.0

type JWTOptions struct {
	Realm      string        `json:"realm"       mapstructure:"realm"`
	Key        string        `json:"key"         mapstructure:"key"`
	Timeout    time.Duration `json:"timeout"     mapstructure:"timeout"`
	MaxRefresh time.Duration `json:"max-refresh" mapstructure:"max-refresh"`
}

JWTOptions jwt 配置选项

func NewJwtOptions added in v0.2.0

func NewJwtOptions() *JWTOptions

NewJwtOptions 创建一个带有默认参数的 JWTOptions 对象。

func (*JWTOptions) AddFlags added in v0.2.0

func (s *JWTOptions) AddFlags(fs *pflag.FlagSet)

AddFlags 将 jwt 的各个字段追加到传入的 pflag.FlagSet 变量中。

func (*JWTOptions) Validate added in v0.2.0

func (s *JWTOptions) Validate() []error

Validate 验证选项字段。

type MySQLOptions

type MySQLOptions struct {
	Host                  string        `json:"host,omitempty"                     mapstructure:"host"`
	Username              string        `json:"username,omitempty"                 mapstructure:"username"`
	Password              string        `json:"-"                                  mapstructure:"password"`
	Database              string        `json:"database"                           mapstructure:"database"`
	MaxIdleConnections    int           `json:"max-idle-connections,omitempty"     mapstructure:"max-idle-connections"`
	MaxOpenConnections    int           `json:"max-open-connections,omitempty"     mapstructure:"max-open-connections"`
	MaxConnectionLifeTime time.Duration `json:"max-connection-life-time,omitempty" mapstructure:"max-connection-life-time"`
	LogLevel              int           `json:"log-level"                          mapstructure:"log-level"`
	LogEnableColor        bool          `json:"log-enable-color"                   mapstructure:"log-enable-color"`
}

MySQLOptions 为mysql数据库定义选项

func NewMySQLOptions

func NewMySQLOptions() *MySQLOptions

NewMySQLOptions 创建一个带有默认参数的 MySQLOptions 对象。

func (*MySQLOptions) AddFlags

func (o *MySQLOptions) AddFlags(fs *pflag.FlagSet)

AddFlags 将 mysql 的各个字段追加到传入的 pflag.FlagSet 变量中。

func (*MySQLOptions) NewClient

func (o *MySQLOptions) NewClient() (*gorm.DB, error)

NewClient 使用给定的配置创建 MySQL DB。

func (*MySQLOptions) Validate

func (o *MySQLOptions) Validate() []error

Validate 验证选项字段。

type RedisOptions

type RedisOptions struct {
	Host                  string   `json:"host"                     mapstructure:"host"`
	Port                  int      `json:"port"                     mapstructure:"port"`
	Addrs                 []string `json:"addrs"                    mapstructure:"addrs"`
	Username              string   `json:"username"                 mapstructure:"username"`
	Password              string   `json:"password"                 mapstructure:"password"`
	Database              int      `json:"database"                 mapstructure:"database"`
	MasterName            string   `json:"master-name"              mapstructure:"master-name"`
	MaxIdle               int      `json:"optimisation-max-idle"    mapstructure:"optimisation-max-idle"`
	MaxActive             int      `json:"optimisation-max-active"  mapstructure:"optimisation-max-active"`
	Timeout               int      `json:"timeout"                  mapstructure:"timeout"`
	EnableCluster         bool     `json:"enable-cluster"           mapstructure:"enable-cluster"`
	UseSSL                bool     `json:"use-ssl"                  mapstructure:"use-ssl"`
	SSLInsecureSkipVerify bool     `json:"ssl-insecure-skip-verify" mapstructure:"ssl-insecure-skip-verify"`
}

RedisOptions 为 redis 定义选项

func NewRedisOptions

func NewRedisOptions() *RedisOptions

NewRedisOptions 创建一个带有默认参数的 RedisOptions 对象。

func (*RedisOptions) AddFlags

func (o *RedisOptions) AddFlags(fs *pflag.FlagSet)

AddFlags 将 redis 的各个字段追加到传入的 pflag.FlagSet 变量中。

func (*RedisOptions) Validate

func (o *RedisOptions) Validate() []error

Validate 验证选项字段。

Jump to

Keyboard shortcuts

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