dbUtils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

* * @Author: TheLife * @Date: 2020-4-24 1:38 下午

* * @Author: TheLife * @Date: 2020-2-25 9:00 下午

* * @Author: TheLife * @Date: 2020-11-8 6:50 下午

* * @Author: TheLife * @Date: 2020-11-8 7:04 下午

* * @Author: TheLife * @Date: 2020-11-8 6:58 下午

* * @Author: TheLife * @Date: 2020-2-25 9:00 下午

* * @Author: TheLife * @Date: 2020-11-8 6:27 下午

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldTab

func FieldTab(tab ...T) []string

func InitDb

func InitDb(utils *DbUtils, defaultDb *gorm.DB) *gorm.DB

Types

type DbJoin

type DbJoin struct {
	LeftJoin []join.LeftJoin
}

type DbOffset

type DbOffset offset.Offset

type DbOrder

type DbOrder order.Order

type DbUpdates

type DbUpdates struct {
	Arithmetic []update.Arithmetic
	Set        []update.Set
}

type DbUtils

type DbUtils struct {
	Db      *gorm.DB `json:"-"`
	Wheres  *DbWheres
	Updates *DbUpdates
	Orders  *DbOrder
	Joins   *DbJoin
	Offset  *DbOffset
}

func (*DbUtils) CrudAll

func (d *DbUtils) CrudAll(fields []string, where interface{}, list interface{}, defaultDb *gorm.DB) error

func (*DbUtils) CrudAllPage

func (d *DbUtils) CrudAllPage(fields []string, where interface{}, list interface{}, limit uint, defaultDb *gorm.DB) (count uint, err error)

func (*DbUtils) CrudCount

func (d *DbUtils) CrudCount(where interface{}, defaultDb *gorm.DB) (count uint, err error)

func (*DbUtils) CrudDelete

func (d *DbUtils) CrudDelete(where interface{}, defaultDb *gorm.DB) error

func (*DbUtils) CrudOne

func (d *DbUtils) CrudOne(fields []string, where interface{}, one interface{}, defaultDb *gorm.DB) error

func (*DbUtils) CrudSum

func (d *DbUtils) CrudSum(field string, where interface{}, defaultDb *gorm.DB) (sum float32, err error)

func (*DbUtils) CrudUpdate

func (d *DbUtils) CrudUpdate(updates map[string]interface{}, where interface{}, defaultDb *gorm.DB, limit1 bool) (err error)

func (*DbUtils) GetJoin

func (d *DbUtils) GetJoin(tx *gorm.DB) *gorm.DB

func (*DbUtils) GetOffSet

func (d *DbUtils) GetOffSet(tx *gorm.DB) *gorm.DB

func (*DbUtils) GetOrder

func (d *DbUtils) GetOrder(tx *gorm.DB) *gorm.DB

func (*DbUtils) GetUpdate

func (d *DbUtils) GetUpdate() (m *map[string]interface{})

func (*DbUtils) GetWhere

func (d *DbUtils) GetWhere(tx *gorm.DB) *gorm.DB

func (*DbUtils) Join

func (d *DbUtils) Join(w interface{}) *DbUtils

func (*DbUtils) OffSet

func (d *DbUtils) OffSet(w interface{}) *DbUtils

func (*DbUtils) Order

func (d *DbUtils) Order(w interface{}) *DbUtils

func (*DbUtils) Update

func (d *DbUtils) Update(w interface{}) *DbUtils

func (*DbUtils) Where

func (d *DbUtils) Where(w interface{}) *DbUtils

func (*DbUtils) WhereIsEmpty

func (d *DbUtils) WhereIsEmpty() bool

type DbWheres

type DbWheres struct {
	Compare []where.Compare
	Range   []where.Range
	In      []where.In
	Like    []where.Like
}

type Field

type Field struct {
	Name   string
	AsName string
}

type T

type T struct {
	TableName string
	Fields    []Field
}

Jump to

Keyboard shortcuts

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