database

package
v0.0.0-...-289f9df Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition []any

type ConditionApplier

type ConditionApplier[DB any] interface {
	Apply(DB) (DB, error)
}

type DBHolder

type DBHolder[DB any] interface {
	GetDB() DB
}

type DSN

type DSN string

func (DSN) Encode

func (d DSN) Encode() string

func (DSN) RemoveSchema

func (d DSN) RemoveSchema() string

func (DSN) Type

func (d DSN) Type() Type

type GoroutineTransaction

type GoroutineTransaction interface {
	Begin(sets ...func(*sql.TxOptions))
	Commit() error
	Rollback() error
	Transaction(f func() error, sets ...func(*sql.TxOptions)) error
}

type Migrator

type Migrator interface {
	RegisterMigrates(...any) error
	Migrate() error
	Up(stepNum int) error
	Down(stepNum int) error
}

type Order

type Order []string

type Repository

type Repository[Entity any] interface {
	Create(...*Entity) error
	Update(structOrMap any, conditions ...any) error
	First(conditions ...any) (*Entity, error)
	List(conditions ...any) ([]*Entity, error)
	Delete(conditions ...any) error
	Pagination(offset, limit int, conditions ...any) (total int64, list []*Entity, err error)
}

type TransactionTx

type TransactionTx[T any] interface {
	BeginTx(sets ...func(*sql.TxOptions)) T
	TransactionTx(f func(tx T) error, sets ...func(*sql.TxOptions)) error
}

type Type

type Type string

Type is database type. e.g. mysql, postgres

const (
	TypeMysql    Type = "mysql"
	TypePostgres Type = "postgres"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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