Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrRecordNotFound returns a "record not found error". Occurs only when attempting to query the database with a struct; querying with a slice won't return this error ErrRecordNotFound = gorm.ErrRecordNotFound // ErrInvalidSQL occurs when you attempt a query with invalid SQL //ErrInvalidSQL = gorm.ErrInvalidSQL // ErrInvalidTransaction occurs when you are trying to `Commit` or `Rollback` ErrInvalidTransaction = gorm.ErrInvalidTransaction )
Functions ¶
This section is empty.
Types ¶
type Association ¶
type Association = gorm.Association
ModelStruct ... ModelStruct = gorm.ModelStruct Field ... Field = gorm.Field FieldStruct ... StructField = gorm.StructField RowQueryResult ... RowQueryResult = gorm.RowQueryResult RowsQueryResult ... RowsQueryResult = gorm.RowsQueryResult Association ...
type Config ¶
type Config struct { // DSN地址: mysql://root:secret@tcp(127.0.0.1:3307)/mysql?timeout=20s&readTimeout=20s DSN string `json:"dsn" toml:"dsn"` // Debug开关 Debug bool `json:"debug" toml:"debug"` // 最大空闲连接数 MaxIdleConns int `json:"maxIdleConns" toml:"maxIdleConns"` // 最大活动连接数 MaxOpenConns int `json:"maxOpenConns" toml:"maxOpenConns"` // 连接的最大存活时间 ConnMaxLifetime time.Duration `json:"connMaxLifetime" toml:"connMaxLifetime"` // 创建连接的错误级别,=panic时,如果创建失败,立即panic OnDialError string `json:"level" toml:"level"` // 慢日志阈值 SlowThreshold time.Duration `json:"slowThreshold" toml:"slowThreshold"` // 拨超时时间 DialTimeout time.Duration `json:"dialTimeout" toml:"dialTimeout"` // 关闭指标采集 DisableMetric bool `json:"disableMetric" toml:"disableMetric"` // 关闭链路追踪 DisableTrace bool `json:"disableTrace" toml:"disableTrace"` // 记录错误sql时,是否打印包含参数的完整sql语句 // select * from aid = ?; // select * from aid = 288016; DetailSQL bool `json:"detailSql" toml:"detailSql"` // contains filtered or unexported fields }
config options
func TemplateConfig ¶
type DB ¶
SQLCommon alias of gorm.SQLCommon SQLCommon = gorm.SQLCommon Callback alias of gorm.Callback Callback = gorm.Callback CallbackProcessor alias of gorm.CallbackProcessor CallbackProcessor = gorm.CallbackProcessor Dialect alias of gorm.Dialect Dialect = gorm.Dialect Scope ... Scope = gorm.Scope DB ...
Click to show internal directories.
Click to hide internal directories.