Documentation ¶
Index ¶
- Variables
- type ConnPool
- func (*ConnPool) Descriptor() ([]byte, []int)deprecated
- func (x *ConnPool) GetMaxIdleConn() int32
- func (x *ConnPool) GetMaxIdleTime() string
- func (x *ConnPool) GetMaxLifeTime() string
- func (x *ConnPool) GetMaxOpenConn() int32
- func (*ConnPool) ProtoMessage()
- func (x *ConnPool) ProtoReflect() protoreflect.Message
- func (x *ConnPool) Reset()
- func (x *ConnPool) String() string
- type EngineConfig
- func (*EngineConfig) Descriptor() ([]byte, []int)deprecated
- func (x *EngineConfig) GetConnPool() *ConnPool
- func (x *EngineConfig) GetCreateBatchSize() int32
- func (x *EngineConfig) GetDisableAutomaticPing() bool
- func (x *EngineConfig) GetDriver() string
- func (x *EngineConfig) GetDsn() string
- func (x *EngineConfig) GetOrmLogConfig() *OrmLogConfig
- func (x *EngineConfig) GetPrepareStmt() bool
- func (x *EngineConfig) GetSkipDefaultTransaction() bool
- func (*EngineConfig) ProtoMessage()
- func (x *EngineConfig) ProtoReflect() protoreflect.Message
- func (x *EngineConfig) Reset()
- func (x *EngineConfig) String() string
- type OrmLogConfig
- func (*OrmLogConfig) Descriptor() ([]byte, []int)deprecated
- func (x *OrmLogConfig) GetColorful() bool
- func (x *OrmLogConfig) GetIgnoreRecordNotFoundError() bool
- func (x *OrmLogConfig) GetLogLevel() string
- func (x *OrmLogConfig) GetSlowThreshold() string
- func (*OrmLogConfig) ProtoMessage()
- func (x *OrmLogConfig) ProtoReflect() protoreflect.Message
- func (x *OrmLogConfig) Reset()
- func (x *OrmLogConfig) String() string
- type ZapConfig
- func (*ZapConfig) Descriptor() ([]byte, []int)deprecated
- func (x *ZapConfig) GetCompress() bool
- func (x *ZapConfig) GetDebugModeOutputConsole() bool
- func (x *ZapConfig) GetFileName() string
- func (x *ZapConfig) GetJsonFormat() bool
- func (x *ZapConfig) GetLevel() string
- func (x *ZapConfig) GetMaxAge() uint32
- func (x *ZapConfig) GetMaxBackup() uint32
- func (x *ZapConfig) GetMaxSize() uint32
- func (*ZapConfig) ProtoMessage()
- func (x *ZapConfig) ProtoReflect() protoreflect.Message
- func (x *ZapConfig) Reset()
- func (x *ZapConfig) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var File_config_db_engine_config_proto protoreflect.FileDescriptor
View Source
var File_config_zap_config_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type ConnPool ¶
type ConnPool struct { // 数据库连接池配置 // max_open_conn 最大连接数量, 默认是0,表示不限制链接数量 // @gotags: toml:"max_open_conn" MaxOpenConn *int32 `protobuf:"varint,1,opt,name=max_open_conn,json=maxOpenConn,proto3,oneof" json:"max_open_conn,omitempty" toml:"max_open_conn"` // 如果 max_open_conn 大于 0 但小于新的 max_idle_conn,则新的 max_idle_conn 将减少以匹配 max_open_conn 限制。 // max_idle_conn 最大空闲链接链接数量, 小于等于 0 表示不保留任何空闲链接, 默认为 2 表示保留两个空闲链接 // @gotags: toml:"max_idle_conn" MaxIdleConn *int32 `protobuf:"varint,2,opt,name=max_idle_conn,json=maxIdleConn,proto3,oneof" json:"max_idle_conn,omitempty" toml:"max_idle_conn"` // 链接的最长存活时间, 如果小于等于 0,表示链接不会关闭 // @gotags: toml:"max_life_time" MaxLifeTime *string `protobuf:"bytes,3,opt,name=max_life_time,json=maxLifeTime,proto3,oneof" json:"max_life_time,omitempty" toml:"max_life_time"` // 设置空闲链接的最长存活时间 // 超时的链接可能会在被复用之前延迟关闭 // 如果设置的值小于等于0, 那么空闲链接不会因为超时而关闭 // @gotags: toml:"max_idle_time" MaxIdleTime *string `protobuf:"bytes,4,opt,name=max_idle_time,json=maxIdleTime,proto3,oneof" json:"max_idle_time,omitempty" toml:"max_idle_time"` // contains filtered or unexported fields }
连接池配置
func (*ConnPool) Descriptor
deprecated
func (*ConnPool) GetMaxIdleConn ¶
func (*ConnPool) GetMaxIdleTime ¶
func (*ConnPool) GetMaxLifeTime ¶
func (*ConnPool) GetMaxOpenConn ¶
func (*ConnPool) ProtoMessage ¶
func (*ConnPool) ProtoMessage()
func (*ConnPool) ProtoReflect ¶
func (x *ConnPool) ProtoReflect() protoreflect.Message
type EngineConfig ¶
type EngineConfig struct { // 使用驱动的名称, [mysql, postgres] // @gotags: toml:"driver" Driver string `protobuf:"bytes,1,opt,name=driver,proto3" json:"driver,omitempty" toml:"driver"` // 数据库链接的基本信息 // @gotags: toml:"dsn" Dsn string `protobuf:"bytes,2,opt,name=dsn,proto3" json:"dsn,omitempty" toml:"dsn"` // gorm 提供的配置 // @gotags: toml:"skip_default_transaction" SkipDefaultTransaction *bool `` /* 168-byte string literal not displayed */ // @gotags: toml:"prepare_stmt" PrepareStmt *bool `protobuf:"varint,4,opt,name=prepare_stmt,json=prepareStmt,proto3,oneof" json:"prepare_stmt,omitempty" toml:"prepare_stmt"` // @gotags: toml:"disable_automatic_ping" DisableAutomaticPing *bool `` /* 160-byte string literal not displayed */ // @gotags: toml:"create_batch_size" CreateBatchSize *int32 `` /* 140-byte string literal not displayed */ // 连接池配置 // @gotags: toml:"conn_pool" ConnPool *ConnPool `protobuf:"bytes,7,opt,name=conn_pool,json=connPool,proto3" json:"conn_pool,omitempty" toml:"conn_pool"` // 日志记录配置 // @gotags: toml:"orm_log_config" OrmLogConfig *OrmLogConfig `protobuf:"bytes,8,opt,name=orm_log_config,json=ormLogConfig,proto3" json:"orm_log_config,omitempty" toml:"orm_log_config"` // contains filtered or unexported fields }
func (*EngineConfig) Descriptor
deprecated
func (*EngineConfig) Descriptor() ([]byte, []int)
Deprecated: Use EngineConfig.ProtoReflect.Descriptor instead.
func (*EngineConfig) GetConnPool ¶
func (x *EngineConfig) GetConnPool() *ConnPool
func (*EngineConfig) GetCreateBatchSize ¶
func (x *EngineConfig) GetCreateBatchSize() int32
func (*EngineConfig) GetDisableAutomaticPing ¶
func (x *EngineConfig) GetDisableAutomaticPing() bool
func (*EngineConfig) GetDriver ¶
func (x *EngineConfig) GetDriver() string
func (*EngineConfig) GetDsn ¶
func (x *EngineConfig) GetDsn() string
func (*EngineConfig) GetOrmLogConfig ¶
func (x *EngineConfig) GetOrmLogConfig() *OrmLogConfig
func (*EngineConfig) GetPrepareStmt ¶
func (x *EngineConfig) GetPrepareStmt() bool
func (*EngineConfig) GetSkipDefaultTransaction ¶
func (x *EngineConfig) GetSkipDefaultTransaction() bool
func (*EngineConfig) ProtoMessage ¶
func (*EngineConfig) ProtoMessage()
func (*EngineConfig) ProtoReflect ¶
func (x *EngineConfig) ProtoReflect() protoreflect.Message
func (*EngineConfig) Reset ¶
func (x *EngineConfig) Reset()
func (*EngineConfig) String ¶
func (x *EngineConfig) String() string
type OrmLogConfig ¶
type OrmLogConfig struct { // 查询日志配置 // 慢查询日志的时长 // 默认 1 秒 // @gotags: toml:"slow_threshold" SlowThreshold string `protobuf:"bytes,1,opt,name=slow_threshold,json=slowThreshold,proto3" json:"slow_threshold,omitempty" toml:"slow_threshold"` // 默认值为 info // @gotags: toml:"log_level" LogLevel string `protobuf:"bytes,2,opt,name=log_level,json=logLevel,proto3" json:"log_level,omitempty" toml:"log_level"` // @gotags: toml:"ignore_record_not_found_error" IgnoreRecordNotFoundError bool `` /* 180-byte string literal not displayed */ // @gotags: toml:"colorful" Colorful bool `protobuf:"varint,4,opt,name=colorful,proto3" json:"colorful,omitempty" toml:"colorful"` // contains filtered or unexported fields }
gorm 日志配置
func (*OrmLogConfig) Descriptor
deprecated
func (*OrmLogConfig) Descriptor() ([]byte, []int)
Deprecated: Use OrmLogConfig.ProtoReflect.Descriptor instead.
func (*OrmLogConfig) GetColorful ¶
func (x *OrmLogConfig) GetColorful() bool
func (*OrmLogConfig) GetIgnoreRecordNotFoundError ¶
func (x *OrmLogConfig) GetIgnoreRecordNotFoundError() bool
func (*OrmLogConfig) GetLogLevel ¶
func (x *OrmLogConfig) GetLogLevel() string
func (*OrmLogConfig) GetSlowThreshold ¶
func (x *OrmLogConfig) GetSlowThreshold() string
func (*OrmLogConfig) ProtoMessage ¶
func (*OrmLogConfig) ProtoMessage()
func (*OrmLogConfig) ProtoReflect ¶
func (x *OrmLogConfig) ProtoReflect() protoreflect.Message
func (*OrmLogConfig) Reset ¶
func (x *OrmLogConfig) Reset()
func (*OrmLogConfig) String ¶
func (x *OrmLogConfig) String() string
type ZapConfig ¶
type ZapConfig struct { // @gotags: toml:"file_name" FileName string `protobuf:"bytes,1,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty" toml:"file_name"` // 日志文件的名称, 默认值是 biz.log // @gotags: toml:"level" Level string `protobuf:"bytes,2,opt,name=level,proto3" json:"level,omitempty" toml:"level"` // 日志等级, ["debug","info","warn","error"], 默认是 info // @gotags: toml:"json_format" JsonFormat *bool `protobuf:"varint,3,opt,name=json_format,json=jsonFormat,proto3,oneof" json:"json_format,omitempty" toml:"json_format"` // 是否开启json格式, 默认不开启 // @gotags: toml:"max_size" MaxSize *uint32 `protobuf:"varint,4,opt,name=max_size,json=maxSize,proto3,oneof" json:"max_size,omitempty" toml:"max_size"` // 文件容量的最大值,单位是 mb, 默认是 1024 // @gotags: toml:"max_backup" MaxBackup *uint32 `protobuf:"varint,5,opt,name=max_backup,json=maxBackup,proto3,oneof" json:"max_backup,omitempty" toml:"max_backup"` // 最大文件的保留数量, 默认保留200个 // @gotags: toml:"max_age" MaxAge *uint32 `protobuf:"varint,6,opt,name=max_age,json=maxAge,proto3,oneof" json:"max_age,omitempty" toml:"max_age"` // 保存的最大天数, 默认保留7天 // @gotags: toml:"compress" Compress *bool `protobuf:"varint,7,opt,name=compress,proto3,oneof" json:"compress,omitempty" toml:"compress"` // 是否压缩日志, 默认不压缩 // @gotags: toml:"debug_mode_output_console" DebugModeOutputConsole *bool `` // debug 模式下输出到控制台, 默认不输出 /* 171-byte string literal not displayed */ // contains filtered or unexported fields }
日志初始化配置, proto3 optional 特性
func (*ZapConfig) Descriptor
deprecated
func (*ZapConfig) GetCompress ¶
func (*ZapConfig) GetDebugModeOutputConsole ¶
func (*ZapConfig) GetFileName ¶
func (*ZapConfig) GetJsonFormat ¶
func (*ZapConfig) GetMaxBackup ¶
func (*ZapConfig) GetMaxSize ¶
func (*ZapConfig) ProtoMessage ¶
func (*ZapConfig) ProtoMessage()
func (*ZapConfig) ProtoReflect ¶
func (x *ZapConfig) ProtoReflect() protoreflect.Message
Click to show internal directories.
Click to hide internal directories.