database

package
v0.0.0-...-e368738 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithTx

func WithTx(ctx context.Context, client *ent.Client, fn func(tx *ent.Tx) error) error

Types

type Database

type Database struct {
	*ent.Client

	Log *zerolog.Logger
	Cfg *config.Config
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(cfg *config.Config, log *zerolog.Logger) *Database

func (*Database) ConnectDatabase

func (db *Database) ConnectDatabase() error

func (*Database) SeedModels

func (db *Database) SeedModels(ctx context.Context, seeder ...Seeder)

func (*Database) ShutdownDatabase

func (db *Database) ShutdownDatabase() error

func (*Database) Sql

func (db *Database) Sql() *sql.Driver

type Seeder

type Seeder interface {
	Count(ctx context.Context, conn *ent.Client) (int, error)
	Seed(ctx context.Context, conn *ent.Client) error
}

Jump to

Keyboard shortcuts

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