Documentation ¶
Index ¶
- Constants
- func GetNotFoundErr(err error) *errorx.Error
- func IsNotFoundErr(err error, errCode int32) bool
- func ScopeTxGo(db *gorm.DB, callbacks ...TxCallback) error
- func TxGo(db *gorm.DB, executes ...TxHandler) error
- type GenerateIDFunc
- type ModelBase
- type OrderColumn
- type ProtoDeletedAt
- type ProtoUpsertedAt
- type QueryOpts
- type Scope
- func (s *Scope) Association(value string) *Scope
- func (s *Scope) Between(field string, arg1, arg2 interface{}) *Scope
- func (s *Scope) Count() (total int64, err error)
- func (s *Scope) Create(v interface{}) error
- func (s *Scope) CreateInBatches(values interface{}, batchSize int) error
- func (s *Scope) Delete(conds ...interface{}) error
- func (s *Scope) Eq(field string, arg interface{}) *Scope
- func (s *Scope) Exist(conds ...interface{}) (bool, error)
- func (s *Scope) Find(dest interface{}, conds ...interface{}) error
- func (s *Scope) First(dest interface{}, conds ...interface{}) error
- func (s *Scope) Group(name string) *Scope
- func (s *Scope) Groups(names ...string) *Scope
- func (s *Scope) Gt(field string, arg interface{}) *Scope
- func (s *Scope) Gte(field string, arg interface{}) *Scope
- func (s *Scope) HandlePaginate(opt *paging.Paginate) *paging.Paginate
- func (s *Scope) Having(query interface{}, args ...interface{}) *Scope
- func (s *Scope) IgnoreNotFoundErr() *Scope
- func (s *Scope) In(field string, values interface{}) *Scope
- func (s *Scope) Joins(query string, args ...interface{}) *Scope
- func (s *Scope) Like(field string, value string) *Scope
- func (s *Scope) LikePrefix(field string, value string) *Scope
- func (s *Scope) Limit(limit int) *Scope
- func (s *Scope) Lt(field string, arg interface{}) *Scope
- func (s *Scope) Lte(field string, arg interface{}) *Scope
- func (s *Scope) MultiOr(opts map[string]interface{}) *Scope
- func (s *Scope) MultiOrLike(opts map[string]string, isPrefix bool) *Scope
- func (s *Scope) Ne(field string, arg interface{}) *Scope
- func (s *Scope) NotBetween(field string, arg1, arg2 interface{}) *Scope
- func (s *Scope) NotIn(field string, values interface{}) *Scope
- func (s *Scope) Offset(offset int) *Scope
- func (s *Scope) Omit(value ...string) *Scope
- func (s *Scope) Or(query interface{}, args ...interface{}) *Scope
- func (s *Scope) Order(value string) *Scope
- func (s *Scope) Orders(values ...OrderColumn) *Scope
- func (s *Scope) PaginateQuery(opt *paging.Paginate, list interface{}) (*paging.Paginate, error)
- func (s *Scope) Preload(query string, args ...interface{}) *Scope
- func (s *Scope) Query(opts *QueryOpts) *Scope
- func (s *Scope) ResetSysDateTimeField(v interface{})
- func (s *Scope) Select(fields ...string) *Scope
- func (s *Scope) SetGenerateIDFunc(idFunc GenerateIDFunc) *Scope
- func (s *Scope) SetNotFoundErr(notFoundErrCode int32) *Scope
- func (s *Scope) Unscoped() *Scope
- func (s *Scope) Update(v interface{}, conds ...interface{}) error
- func (s *Scope) Where(query interface{}, args ...interface{}) *Scope
- type TxCallback
- type TxHandler
Constants ¶
View Source
const ( ProtoMessageFieldCreatedAt = "created_at" ProtoMessageFieldUpdatedAt = "updated_at" ProtoMessageFieldDeletedAt = "deleted_at" )
View Source
const DefaultLimit uint32 = 2000
View Source
const DefaultOffset uint32 = 0
View Source
const MaxLimit uint32 = 100000
Variables ¶
This section is empty.
Functions ¶
func GetNotFoundErr ¶
func IsNotFoundErr ¶
IsNotFoundErr returns true if err is an *Error and its ErrorCode matches ErrCodeRecordNotFoundSys or errCode.
Types ¶
type ModelBase ¶
type ModelBase interface { ProtoReflect() protoreflect.Message GetId() uint64 }
type OrderColumn ¶
type ProtoDeletedAt ¶
type ProtoDeletedAt interface {
GetDeletedAt() uint32
}
type ProtoUpsertedAt ¶
type ProtoUpsertedAt interface { ProtoReflect() protoreflect.Message GetCreatedAt() uint32 GetUpdatedAt() uint32 ProtoDeletedAt }
type Scope ¶
func NewScopeOfPure ¶
func (*Scope) Association ¶
func (*Scope) CreateInBatches ¶
CreateInBatches Insert data in batches after splitting data according to batchSize
func (*Scope) HandlePaginate ¶
func (*Scope) IgnoreNotFoundErr ¶
func (*Scope) MultiOrLike ¶
func (*Scope) NotBetween ¶
func (*Scope) Orders ¶
func (s *Scope) Orders(values ...OrderColumn) *Scope
func (*Scope) PaginateQuery ¶
func (*Scope) ResetSysDateTimeField ¶
func (s *Scope) ResetSysDateTimeField(v interface{})
ResetSysDateTimeField To prevent someone from passing in these three fields by mistake, this method is provided to reset
func (*Scope) SetGenerateIDFunc ¶
func (s *Scope) SetGenerateIDFunc(idFunc GenerateIDFunc) *Scope
func (*Scope) SetNotFoundErr ¶
type TxCallback ¶
Click to show internal directories.
Click to hide internal directories.