Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDialector ¶
NewDialector creates a new GORM dialector using the given input configurations. It automatically selects between a MySQL or Postgres dialector depending on the input configuration type.
Types ¶
type DialectorInput ¶
type DialectorInput struct {
// A function that determines whether a new configuration should be used
// for the next connection
ShouldReconfigureCallback connectors.ShouldReconfigureCallback
// The maximum duration to allow a connection to remain idle before closing it
ConnMaxIdleTime *time.Duration
// The maximum duration to allow a connection to remain open (regardless of
// whether it is idle) before closing it
ConnMaxLifetime *time.Duration
// The maximum number of idle connections that can remain open
MaxIdleConns *int
// The maximum number of connections (regardless of whether they are idle)
// that can be open at any given time.
MaxOpenConns *int
}
The common (relevant to all database types) configuration values that should be used for new connections.
type MysqlDialectorInput ¶
type MysqlDialectorInput struct {
// Common (not specific to MySQL) input values
DialectorInput
// The GORM-specific MySQL configuration values to use
GormMysqlConfig gormmysql.Config
// A function that gets the config to use for the next
// MySQL connection
GetMysqlConfigCallback connectors.GetMysqlConfigCallback
}
func (MysqlDialectorInput) Clone ¶
func (di MysqlDialectorInput) Clone() MysqlDialectorInput
Returns a new copy of the MysqlDialectorInput struct
type PostgresDialectorInput ¶
type PostgresDialectorInput struct {
// Common (not specific to PostgreSQL) input values
DialectorInput
// The GORM-specific PostgreSQL configuration values to use
GormPostgresConfig gormpostgres.Config
// A function that gets the config to use for the next
// PostgreSQL connection
GetPostgresConfigCallback connectors.GetPostgresConfigCallback
}
func (PostgresDialectorInput) Clone ¶
func (di PostgresDialectorInput) Clone() PostgresDialectorInput
Returns a new copy of the PostgresDialectorInput struct
Click to show internal directories.
Click to hide internal directories.