Documentation
¶
Index ¶
- func BuildQuery(f any) (string, []any)
- func Count(ctx context.Context, v schema.Tabler, f Filter) (total int64, err error)
- func Create(ctx context.Context, v any) error
- func Delete(ctx context.Context, m schema.Tabler, f Filter) (int64, error)
- func EscapeField(field string) string
- func Find(ctx context.Context, f Filter, v any) error
- func FindOne(ctx context.Context, f Filter, v any) error
- func GetDB(ctx context.Context) *gorm.DB
- func HasNextPage(total int64, page int64, pageSize int64) bool
- func HasRecrods(total int64, page int64, pageSize int64) bool
- func Init(cfg Config)
- func IsDbError(err error) bool
- func IsRecordNotFound(err error) bool
- func Save(ctx context.Context, v any) error
- func Update(ctx context.Context, m schema.Tabler, v any) error
- func Updates(ctx context.Context, m schema.Tabler, f Filter, v any) (int64, error)
- type BaseFilter
- type Config
- type F
- func Eq[T any](v T) F[T]
- func Gt[T any](v T) F[T]
- func Gte[T any](v T) F[T]
- func In[T any](v []T) F[[]T]
- func Like[T any](v T) F[T]
- func Lt[T any](v T) F[T]
- func Lte[T any](v T) F[T]
- func NewEmptyF[T any](v T) F[T]
- func NewF[T any](op string, value T) F[T]
- func NotEq[T any](v T) F[T]
- func NotIn[T any](v []T) F[[]T]
- func NotLike[T any](v T) F[T]
- func Omit[T any](v T, fn func(T) F[T]) F[T]
- func OmitEq[T any](v T) F[T]
- func OmitGt[T any](v T) F[T]
- func OmitGte[T any](v T) F[T]
- func OmitIn[T any](v []T) F[[]T]
- func OmitLike[T any](v T) F[T]
- func OmitLt[T any](v T) F[T]
- func OmitLte[T any](v T) F[T]
- func OmitNotEq[T any](v T) F[T]
- func OmitNotIn[T any](v []T) F[[]T]
- func OmitNotLike[T any](v T) F[T]
- func Omits[T any](v []T, fn func([]T) F[[]T]) F[[]T]
- type Filter
- type Model
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildQuery ¶
func EscapeField ¶
EscapeField 字段名称加上双引号,防止字段名与SQL关键字相同导致查询错误。
func HasNextPage ¶
HasNextPage 是否有下一页
func HasRecrods ¶
HasRecrods 当前页码是否有记录
func IsRecordNotFound ¶
Types ¶
type BaseFilter ¶
BaseFilter 实现Filter接口的结构体
func (BaseFilter) HasNextPage ¶
func (f BaseFilter) HasNextPage(total int64) bool
HasNextPage 是否有下一页
type F ¶
func OmitNotLike ¶
Click to show internal directories.
Click to hide internal directories.