dao

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dao

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

func New

func New(db *gorm.DB) *Dao

func (*Dao) AutoMigrate

func (dao *Dao) AutoMigrate(dst interface{}, settings ...map[string]interface{}) error

func (Dao) BeanName

func (Dao) BeanName() string

func (*Dao) Ctx

func (dao *Dao) Ctx(ctx context.Context) *Dao

func (*Dao) DB

func (dao *Dao) DB() *gorm.DB

func (*Dao) Delete

func (dao *Dao) Delete(cause *wrapper.Query) (int64, error)

func (*Dao) Distinct

func (dao *Dao) Distinct(args ...interface{}) *Dao

func (*Dao) Exist added in v0.1.0

func (dao *Dao) Exist(cause *wrapper.Query) (exist bool, err error)

func (*Dao) FindAll

func (dao *Dao) FindAll(cause *wrapper.Query, target interface{}) error

func (*Dao) FindOne

func (dao *Dao) FindOne(cause *wrapper.Query, target interface{}) (ok bool, err error)

func (*Dao) Insert

func (dao *Dao) Insert(value interface{}) error

func (*Dao) InsertIgnore added in v0.1.0

func (dao *Dao) InsertIgnore(value interface{}) error

func (*Dao) List

func (dao *Dao) List(cause *wrapper.Query, target interface{}, limit ...int) error

func (*Dao) Model

func (dao *Dao) Model(value interface{}) *Dao

func (*Dao) Page

func (dao *Dao) Page(cause *wrapper.Query, target interface{}, page, size int) (total int64, err error)

func (*Dao) Replace added in v0.1.0

func (dao *Dao) Replace(value interface{}) error

func (*Dao) Select

func (dao *Dao) Select(query interface{}, args ...interface{}) *Dao

func (*Dao) Sum

func (dao *Dao) Sum(field string, cause *wrapper.Query, target interface{}) (err error)

func (*Dao) Table

func (dao *Dao) Table(name string, args ...interface{}) *Dao

func (*Dao) Transaction

func (dao *Dao) Transaction(fc func(tx *Dao) error, opts ...*sql.TxOptions) error

func (*Dao) Update

func (dao *Dao) Update(update *wrapper.Update) (int64, error)

func (*Dao) Upsert added in v0.1.0

func (dao *Dao) Upsert(value interface{}, update *wrapper.Update) error

func (*Dao) Where

func (dao *Dao) Where(wrapper *wrapper.Query) *gorm.DB

type Mapper added in v0.1.1

type Mapper[T any] struct {
	// contains filtered or unexported fields
}

func NewMapper added in v0.1.1

func NewMapper[T any](db *gorm.DB) *Mapper[T]

func ToMapper added in v0.1.1

func ToMapper[T any](dao *Dao) *Mapper[T]

func (*Mapper[T]) AutoMigrate added in v0.1.1

func (dao *Mapper[T]) AutoMigrate(settings ...map[string]interface{}) error

func (*Mapper[T]) Count added in v0.1.1

func (dao *Mapper[T]) Count(cause *wrapper.Query) (total int64, err error)

func (*Mapper[T]) DB added in v0.1.1

func (dao *Mapper[T]) DB() *gorm.DB

func (*Mapper[T]) Delete added in v0.1.1

func (dao *Mapper[T]) Delete(cause *wrapper.Query) (int64, error)

func (*Mapper[T]) Distinct added in v0.1.1

func (dao *Mapper[T]) Distinct(args ...interface{}) *Mapper[T]

func (*Mapper[T]) Exist added in v0.1.1

func (dao *Mapper[T]) Exist(cause *wrapper.Query) (exist bool, err error)

func (*Mapper[T]) GetAll added in v0.1.1

func (dao *Mapper[T]) GetAll(cause *wrapper.Query) (records *[]T, err error)

func (*Mapper[T]) GetOne added in v0.1.1

func (dao *Mapper[T]) GetOne(cause *wrapper.Query) (record *T, err error)

func (*Mapper[T]) Insert added in v0.1.1

func (dao *Mapper[T]) Insert(value interface{}) error

func (*Mapper[T]) InsertIgnore added in v0.1.1

func (dao *Mapper[T]) InsertIgnore(value interface{}) error

func (*Mapper[T]) List added in v0.1.1

func (dao *Mapper[T]) List(cause *wrapper.Query, limit ...int) (records *[]T, err error)

func (*Mapper[T]) Page added in v0.1.1

func (dao *Mapper[T]) Page(cause *wrapper.Query, page, size int) (records *[]T, total int64, err error)

func (*Mapper[T]) Replace added in v0.1.1

func (dao *Mapper[T]) Replace(value interface{}) error

func (*Mapper[T]) Select added in v0.1.1

func (dao *Mapper[T]) Select(query interface{}, args ...interface{}) *Mapper[T]

func (*Mapper[T]) Sum added in v0.1.1

func (dao *Mapper[T]) Sum(field string, cause *wrapper.Query) (sum int64, err error)

func (*Mapper[T]) SumDecimal added in v0.1.1

func (dao *Mapper[T]) SumDecimal(field string, cause *wrapper.Query) (sum float64, err error)

func (*Mapper[T]) Table added in v0.1.1

func (dao *Mapper[T]) Table(name string, args ...interface{}) *Mapper[T]

func (*Mapper[T]) Transaction added in v0.1.1

func (dao *Mapper[T]) Transaction(fn func(tx *gorm.DB) error, opts ...*sql.TxOptions) error

func (*Mapper[T]) Update added in v0.1.1

func (dao *Mapper[T]) Update(update *wrapper.Update) (int64, error)

func (*Mapper[T]) Upsert added in v0.1.1

func (dao *Mapper[T]) Upsert(value interface{}, update *wrapper.Update) error

func (*Mapper[T]) Where added in v0.1.1

func (dao *Mapper[T]) Where(wrapper *wrapper.Query) *gorm.DB

Jump to

Keyboard shortcuts

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