dao

package
v0.0.0-...-a0fa9d7 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseDao

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

func NewDao

func NewDao(db db.DB, model Model) *BaseDao

func (*BaseDao) BeginTx

func (d *BaseDao) BeginTx(ctx context.Context) context.Context

func (*BaseDao) CommitTx

func (*BaseDao) CommitTx(ctx context.Context) error

func (*BaseDao) Count

func (d *BaseDao) Count(funcs ...func(db db.DB) db.DB) (count int64)

func (*BaseDao) GetByID

func (d *BaseDao) GetByID(id uint, result Model) (bool, error)

func (*BaseDao) GetDB

func (d *BaseDao) GetDB() db.DB

func (*BaseDao) Insert

func (d *BaseDao) Insert(model Model) error

func (*BaseDao) InsertWithCtx

func (d *BaseDao) InsertWithCtx(ctx context.Context, model Model) error

func (*BaseDao) RollbackTx

func (*BaseDao) RollbackTx(ctx context.Context) error

func (*BaseDao) Transaction

func (d *BaseDao) Transaction(ctx context.Context, fn func(ctx context.Context) error) error

func (*BaseDao) UnwrapContextDBOrDefault

func (d *BaseDao) UnwrapContextDBOrDefault(ctx context.Context) db.DB

func (*BaseDao) UpdatesByID

func (d *BaseDao) UpdatesByID(id uint, data Model) error

func (*BaseDao) UpdatesByIDWithCtx

func (d *BaseDao) UpdatesByIDWithCtx(ctx context.Context, id uint, data Model) error

type Model

type Model interface {
	schema.Tabler
}

Jump to

Keyboard shortcuts

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