dao

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate added in v1.0.0

func Migrate(mdls []any, sqls ...string) error

迁移

Types

type Dao

type Dao[M any] struct {
	Db *gorm.DB
}

数据访问对象

func NewDao

func NewDao[M any]() *Dao[M]

构造函数

func (*Dao[M]) Get

func (d *Dao[M]) Get(conds ...any) (*M, error)

获取

func (*Dao[M]) List

func (d *Dao[M]) List(conds ...any) ([]M, int64, error)

列举

func (*Dao[M]) Make

func (d *Dao[M]) Make(conds ...any) *gorm.DB

组装

func (*Dao[M]) Purge

func (d *Dao[M]) Purge(conds ...any) error

清除

func (*Dao[M]) Remove

func (d *Dao[M]) Remove(conds ...any) error

移除

func (*Dao[M]) Save

func (d *Dao[M]) Save(m M, confs ...clause.Expression) error

保存

func (*Dao[M]) Saves added in v1.0.0

func (d *Dao[M]) Saves(ms []M, confs ...clause.Expression) error

保存集合

func (*Dao[M]) Trans

func (d *Dao[M]) Trans(funcs ...func(tx *gorm.DB) error) error

事务

func (*Dao[M]) Update

func (d *Dao[M]) Update(values map[string]any, conds ...any) error

更新

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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