database

package
v0.1.36 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToViaJSON added in v0.1.0

func ToViaJSON[T any](source any) (target T, err error)

Types

type Config

type Config struct {
	Driver Driver `yaml:"driver"`
	DSN    string `` /* 149-byte string literal not displayed */
}

type DB added in v0.1.0

type DB struct {
	*gorm.DB
}

func Open

func Open(ctx context.Context, params Params) (DB, error)

func (DB) Transaction added in v0.1.0

func (db DB) Transaction(fn func(tx DB) error) error

func (DB) Upsert added in v0.1.0

func (db DB) Upsert(value any) *gorm.DB

func (DB) UpsertInBatches added in v0.1.0

func (db DB) UpsertInBatches(value any, batchSize int) *gorm.DB

func (DB) WithContext added in v0.1.0

func (db DB) WithContext(ctx context.Context) DB

type Driver

type Driver string

func (Driver) SchemaEnum

func (Driver) SchemaEnum() any

type Params added in v0.1.0

type Params struct {
	Clock    based.Clock  `validate:"required"`
	Logger   *slog.Logger `validate:"required"`
	Config   Config       `validate:"required"`
	Entities []any        `validate:"required"`
}

Jump to

Keyboard shortcuts

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