database

package
v0.0.0-...-26f3366 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: AGPL-3.0 Imports: 12 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,omitzero"`

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

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

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

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

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

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