data

package
v0.0.0-...-4b328e9 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("data",
	fx.Provide(
		fx.Annotate(
			func(cfg *config.AppConfig) *config.DatabaseConfig {
				return &cfg.Database
			},
			fx.As(new(*config.DatabaseConfig)),
		),
		ProvideDatabase,
	),
)

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(cfg *config.DatabaseConfig, log *zap.Logger) (*Database, error)

func ProvideDatabase

func ProvideDatabase(lc fx.Lifecycle, cfg *config.DatabaseConfig, log *zap.Logger) (*Database, error)

func (*Database) Client

func (d *Database) Client() *ent.Client

func (*Database) Close

func (d *Database) Close() error

type UserRepo

type UserRepo struct {
	// contains filtered or unexported fields
}

func NewUserRepo

func NewUserRepo(db *Database) *UserRepo

func (*UserRepo) CreateUser

func (r *UserRepo) CreateUser(ctx context.Context, name, email string) (*ent.User, error)

func (*UserRepo) GetUser

func (r *UserRepo) GetUser(ctx context.Context, id int64) (*ent.User, error)

func (*UserRepo) ListUsers

func (r *UserRepo) ListUsers(ctx context.Context) ([]*ent.User, error)

Jump to

Keyboard shortcuts

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