Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultJournalMode = database.JournalModeWAL DefaultTimeout = 3 * time.Second DefaultSyncMode = database.SyncModeNORMAL DefaultForeignKeyConstraintsEnable = true )
Functions ¶
func NewPostgres ¶ added in v0.2.3
NewPostgres creates a new GORM PostgreSQL connection. The connURL should be a PostgreSQL connection string in the format: postgres://user:password@host:port/dbname?sslmode=disable If schema is provided, a separate PostgreSQL schema will be created and used.
Types ¶
type PostgresOptions ¶ added in v0.2.3
type PostgresOptions struct {
// MaxOpenConns is the maximum number of open connections to the database.
MaxOpenConns int
// MaxIdleConns is the maximum number of idle connections in the pool.
MaxIdleConns int
// ConnMaxLifetime is the maximum amount of time a connection may be reused.
ConnMaxLifetime time.Duration
}
PostgresOptions configures a GORM PostgreSQL connection.
func PostgresOptionsFromConfig ¶ added in v0.2.3
func PostgresOptionsFromConfig(cfg app.PostgresConfig) *PostgresOptions
PostgresOptionsFromConfig creates PostgresOptions from app.PoolConfig. Uses conservative defaults for any zero values.
Click to show internal directories.
Click to hide internal directories.