dao

package
v1.19.47 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dao added in v1.19.22

type Dao[E any] interface {
	Insert(entity *E) error
}

type MgoDao

type MgoDao[E any] struct {
	CollectionName string
	Tag            func() string
}

MgoDao 注意使用前必须先将CollectionName赋值

func (MgoDao[E]) All

func (m MgoDao[E]) All(query bson.M) ([]E, error)

All mongo动态查询数据

func (MgoDao[E]) Delete

func (m MgoDao[E]) Delete(query bson.M) error

Delete mongo动态删除数据

func (MgoDao[E]) Insert

func (m MgoDao[E]) Insert(entity *E) error

Insert mongo动态插入数据

func (MgoDao[E]) One

func (m MgoDao[E]) One(query bson.M) (*E, error)

One mongo动态查询一条数据

func (MgoDao[E]) Pager

func (m MgoDao[E]) Pager(query bson.M, sort []string, page, size int) ([]E, *models.ResultPage, error)

Pager mongo简单分页查询数据

func (MgoDao[E]) Updates

func (m MgoDao[E]) Updates(id bson.ObjectId, doc E) error

Updates mongo动态更新数据

type MySQLDao

type MySQLDao[E schema.Tabler] struct {
	Tag func() string
	// contains filtered or unexported fields
}

func (*MySQLDao[E]) All

func (receiver *MySQLDao[E]) All(entity E, opts ...QueryOption) ([]E, error)

All mysql动态查询数据

func (*MySQLDao[E]) Create

func (receiver *MySQLDao[E]) Create(entity *E) error

Create mysql动态插入数据

func (*MySQLDao[E]) Debug added in v1.19.17

func (m *MySQLDao[E]) Debug() *MySQLDao[E]

func (*MySQLDao[E]) Delete

func (receiver *MySQLDao[E]) Delete(entity E) error

Delete mysql动态删除数据

func (*MySQLDao[E]) MultiCreate

func (receiver *MySQLDao[E]) MultiCreate(entities []*E) error

MultiCreate mysql动态插入多条数据

func (*MySQLDao[E]) One

func (receiver *MySQLDao[E]) One(entity E) (*E, error)

One mysql动态查询一条数据

func (*MySQLDao[E]) Pager

func (receiver *MySQLDao[E]) Pager(conn *gorm.DB, page, size int) ([]E, *models.ResultPage, error)

Pager mysql简单分页查询数据

func (*MySQLDao[E]) Save

func (receiver *MySQLDao[E]) Save(entity *E) error

Save mysql动态保存数据

func (*MySQLDao[E]) Updates

func (receiver *MySQLDao[E]) Updates(entity *E) error

Updates mysql动态更新数据

type QueryOption added in v1.19.47

type QueryOption struct {
	Preloads []string
	OrderBy  []string
}

Jump to

Keyboard shortcuts

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