Documentation ¶
Index ¶
- Variables
- func CheckDuplicate(err error) bool
- func CloseMemoryDB(db *gorm.DB)
- func Count(ctx context.Context, db *gorm.DB, model interface{}, ...) (count int64, err error)
- func Delete(ctx context.Context, db *gorm.DB, model interface{}, ...) (int64, error)
- func ExtractError(err error) (mysqlErr *mysql.MySQLError, ok bool)
- func FormatEq(v interface{}) string
- func FormatEqList(m map[string]interface{}) map[string]interface{}
- func FormatGt(v interface{}) string
- func FormatGtList(m map[string]interface{}) map[string]interface{}
- func FormatGte(v interface{}) string
- func FormatGteList(m map[string]interface{}) map[string]interface{}
- func FormatIn(v interface{}) string
- func FormatInList(m map[string]interface{}) map[string]interface{}
- func FormatLike(v interface{}) string
- func FormatLikeList(m map[string]string) map[string]interface{}
- func FormatLt(v interface{}) string
- func FormatLtList(m map[string]interface{}) map[string]interface{}
- func FormatLte(v interface{}) string
- func FormatLteList(m map[string]interface{}) map[string]interface{}
- func FormatNotIn(v interface{}) string
- func FormatNotInList(m map[string]interface{}) map[string]interface{}
- func Insert(ctx context.Context, db *gorm.DB, model interface{}) (int64, error)
- func NewMemoryDB() *gorm.DB
- func Select(ctx context.Context, db *gorm.DB, model interface{}, fields string, ...) (err error)
- func Update(ctx context.Context, db *gorm.DB, model interface{}, ...) (affectRows int64, err error)
- func WithHaving(ctx context.Context, db *gorm.DB, having map[string]interface{}) *gorm.DB
- func WithOrder(ctx context.Context, db *gorm.DB, order []string) *gorm.DB
- func WithWhere(ctx context.Context, db *gorm.DB, where map[string]interface{}) *gorm.DB
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDBNil = errors.New("db is nil")
Functions ¶
func CheckDuplicate ¶
func CloseMemoryDB ¶
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 FormatGteList ¶
FormatGteList
func FormatLikeList ¶
FormatLikeList
func FormatLteList ¶
FormatLteList
func FormatNotInList ¶
FormatNotInList
func NewMemoryDB ¶
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 ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.