Documentation ¶
Index ¶
Constants ¶
View Source
const CSTLayout = "2006-01-02 15:04:05"
CSTLayout China Standard Time Layout
Variables ¶
View Source
var GlobalGormTrace gorm.Plugin = &TracePlugin{}
Functions ¶
func CSTLayoutString ¶
func CSTLayoutString() string
func ShowDbStatus ¶
Types ¶
type Config ¶
type Config struct { SQLName string `json:"sqlName"` Account string `json:"account"` Password string `json:"password"` Address string `json:"address"` Port int `json:"port"` Database string `json:"database"` MaxIdleConn int `json:"maxIdleConn"` MaxOpenConn int `json:"maxOpenConn"` MaxLifetime int `json:"maxLIfetime"` // unit - second IsTrace bool `json:"isTrace"` }
SQL Config of db.
type SqlTraceInfo ¶
type SqlTraceInfo struct { Timestamp string `json:"timestamp"` // time, format like:2006-01-02 15:04:05 Stack string `json:"stack"` // file address and line number SQL string `json:"sql"` // SQL statement Rows int64 `json:"rows_affected"` // Number of rows affected CostSeconds float64 `json:"cost_seconds"` // Execution time (in seconds) }
type TracePlugin ¶
type TracePlugin struct{}
func (*TracePlugin) Initialize ¶
func (op *TracePlugin) Initialize(db *gorm.DB) (err error)
func (*TracePlugin) Name ¶
func (op *TracePlugin) Name() string
Click to show internal directories.
Click to hide internal directories.