confrdb

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointMySQL

type EndpointMySQL = endpoint[option.MySQL]

type EndpointPostgres

type EndpointPostgres = endpoint[option.Postgres]

type EndpointSQLite

type EndpointSQLite = endpoint[option.SQLite]

type Option

type Option[A any] struct {
	// AutoMigration if enable auto migration
	AutoMigration bool `url:"-"`
	// DryRun migration with dry run mode
	DryRun bool `url:"-"`
	// CreateTableOnly just do table creations without column diff and modifications
	CreateTableOnly bool `url:"-"`

	// MaxOpenConns the upper limit on open connections. this should be tuned
	// based on both application concurrency and database server capacity.
	// a typical recommendation is 2-4 times the number of CPU cores of database
	// sever.
	MaxOpenConns int `url:"-"`
	// MaxIdleConns is recommended to be set to the same value as MaxOpenConns.
	MaxIdleConns int `url:"-"`
	// ConnMaxLifetime is recommended to be 0.5 to 1 hour.
	// NOTE: it should lower than sever-side `wait_timeout` setting. (eg: MySQL's `wait_timeout`) .
	// server-side controls the maximum duration connection remains open while idle.
	ConnMaxLifetime types.Duration `url:"-"`
	// ConnMaxIdleTime is recommended to be 5 to 10 minutes to release rapidly of
	// reclaim connection resources.
	ConnMaxIdleTime types.Duration `url:"-"`

	// Name denotes a globally **unique** identifier for a database endpoint and
	// its lifecycle sessions.
	Name string `url:"-"`
	// AdaptorOption for different driver. eg mysql, postgres etc.
	AdaptorOption A `url:",inline"`
}

func (*Option[A]) Apply

func (o *Option[A]) Apply(db *sql.DB)

func (*Option[A]) SetDefault

func (o *Option[A]) SetDefault()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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