config

package
v0.9.5-rc Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_config_db_engine_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) Descriptor() ([]byte, []int)

Deprecated: Use ConnPool.ProtoReflect.Descriptor instead.

func (*ConnPool) GetMaxIdleConn

func (x *ConnPool) GetMaxIdleConn() int32

func (*ConnPool) GetMaxIdleTime

func (x *ConnPool) GetMaxIdleTime() string

func (*ConnPool) GetMaxLifeTime

func (x *ConnPool) GetMaxLifeTime() string

func (*ConnPool) GetMaxOpenConn

func (x *ConnPool) GetMaxOpenConn() int32

func (*ConnPool) ProtoMessage

func (*ConnPool) ProtoMessage()

func (*ConnPool) ProtoReflect

func (x *ConnPool) ProtoReflect() protoreflect.Message

func (*ConnPool) Reset

func (x *ConnPool) Reset()

func (*ConnPool) String

func (x *ConnPool) String() string

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

Jump to

Keyboard shortcuts

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