orm

package
v0.0.0-...-1e877d2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDBNil = errors.New("db is nil")

Functions

func CheckDuplicate

func CheckDuplicate(err error) bool

func CloseMemoryDB

func CloseMemoryDB(db *gorm.DB)

func Count

func Count(ctx context.Context, db *gorm.DB, model interface{}, where map[string]interface{}) (count int64, err error)

Count 数量

func Delete

func Delete(ctx context.Context, db *gorm.DB, model interface{}, where map[string]interface{}) (int64, error)

Delete 删除

func ExtractError

func ExtractError(err error) (mysqlErr *mysql.MySQLError, ok bool)

ExtractError extract gorm error to judge db error

func FormatEq

func FormatEq(v interface{}) string

FormatEq

func FormatEqList

func FormatEqList(m map[string]interface{}) map[string]interface{}

FormatEqList

func FormatGt

func FormatGt(v interface{}) string

FormatGt

func FormatGtList

func FormatGtList(m map[string]interface{}) map[string]interface{}

FormatGtList

func FormatGte

func FormatGte(v interface{}) string

FormatGte

func FormatGteList

func FormatGteList(m map[string]interface{}) map[string]interface{}

FormatGteList

func FormatIn

func FormatIn(v interface{}) string

FormatIn

func FormatInList

func FormatInList(m map[string]interface{}) map[string]interface{}

FormatInList

func FormatLike

func FormatLike(v interface{}) string

FormatLike

func FormatLikeList

func FormatLikeList(m map[string]string) map[string]interface{}

FormatLikeList

func FormatLt

func FormatLt(v interface{}) string

FormatLt

func FormatLtList

func FormatLtList(m map[string]interface{}) map[string]interface{}

FormatLtList

func FormatLte

func FormatLte(v interface{}) string

FormatLte

func FormatLteList

func FormatLteList(m map[string]interface{}) map[string]interface{}

FormatLteList

func FormatNotIn

func FormatNotIn(v interface{}) string

FormatNotIn

func FormatNotInList

func FormatNotInList(m map[string]interface{}) map[string]interface{}

FormatNotInList

func Insert

func Insert(ctx context.Context, db *gorm.DB, model interface{}) (int64, error)

Insert 插入

func NewMemoryDB

func NewMemoryDB() *gorm.DB

func Select

func Select(ctx context.Context, db *gorm.DB, model interface{}, fields string, where map[string]interface{}, group []string, groupData interface{}, having map[string]interface{}, order []string, start, limit int) (err error)

Select 查询

func Update

func Update(ctx context.Context, db *gorm.DB, model interface{}, where map[string]interface{}, updates map[string]interface{}) (affectRows int64, err error)

Update 更新

func WithHaving

func WithHaving(ctx context.Context, db *gorm.DB, having map[string]interface{}) *gorm.DB

func WithOrder

func WithOrder(ctx context.Context, db *gorm.DB, order []string) *gorm.DB

func WithWhere

func WithWhere(ctx context.Context, db *gorm.DB, where map[string]interface{}) *gorm.DB

Types

This section is empty.

Jump to

Keyboard shortcuts

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