db

package
v0.0.0-...-574e995 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("db",
	fx.Provide(NewDbClient),
	fx.Invoke(runDbClient),
)

Functions

func Migrate

func Migrate(ctx context.Context, config *Config) error

func NewDbClient

func NewDbClient(config *Config) (*ent.Client, error)

func NewInMemoryClient

func NewInMemoryClient() (*ent.Client, error)

func NewSQLiteClient

func NewSQLiteClient(config *SQLiteConfig) (*ent.Client, error)

Types

type Config

type Config struct {
	Type        string        `mapstructure:"type" yaml:"type" validate:"required"`
	AutoMigrate bool          `mapstructure:"auto_migrate" yaml:"auto_migrate"`
	SQLite      *SQLiteConfig `mapstructure:"sqlite" yaml:"sqlite"`
}

type SQLiteConfig

type SQLiteConfig struct {
	Dsn string `mapstructure:"dsn" yaml:"dsn" validate:"required"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳