database

package
v0.0.0-...-9cf1cd8 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Driver is the database driver.
	Driver string `json:"driver"`

	// DSN is the data source name.
	DSN string `json:"dsn"`

	// MaxOpenConns is the maximum number of open connections to the database.
	MaxOpenConns int `json:"maxOpenConns"`

	// MaxIdleConns is the maximum number of connections in the idle connection pool.
	MaxIdleConns int `json:"maxIdleConns"`

	// ConnMaxLifetime is the maximum amount of time a connection may be reused.
	ConnMaxLifetime jsonhelper.Duration `json:"connMaxLifetime"`

	// ConnMaxIdleTime is the maximum amount of time a connection may be idle.
	ConnMaxIdleTime jsonhelper.Duration `json:"connMaxIdleTime"`

	// Debug enables verbose logging.
	Debug bool `json:"debug"`

	// NoAutoMigrate disables auto-migration.
	NoAutoMigrate bool `json:"noAutoMigrate"`
}

Config is the configuration for the database.

func (*Config) Open

func (c *Config) Open(ctx context.Context, logger *zap.Logger) (*ent.Client, error)

Open opens the database and runs auto-migration.

Jump to

Keyboard shortcuts

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