Documentation ¶
Index ¶
- func Exists(ctx context.Context, db *gorm.DB) (bool, error)
- func FindOne(ctx context.Context, db *gorm.DB, opts QueryOptions, out any) (bool, error)
- func FindPage(ctx context.Context, db *gorm.DB, pp PaginationParam, opts QueryOptions, ...) (int64, error)
- func GetDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func InitDB(ctx context.Context) (*gorm.DB, func(), error)
- func LikeParameter(v string) string
- func NewDB(c Config) (*gorm.DB, error)
- type Config
- type Direction
- type OrderByParam
- type OrderByParams
- type PaginationParam
- type PaginationResult
- type QueryOptions
- type ResolverConfig
- type Trans
- type TransFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindPage ¶
func FindPage(ctx context.Context, db *gorm.DB, pp PaginationParam, opts QueryOptions, out any) (int64, error)
func LikeParameter ¶
Types ¶
type OrderByParam ¶
type OrderByParams ¶
type OrderByParams []OrderByParam
func (OrderByParams) ToSQL ¶
func (p OrderByParams) ToSQL() string
type PaginationParam ¶
type PaginationResult ¶
type PaginationResult struct { Items any `json:"items"` Total int64 `json:"total"` PageNum int `json:"pageNum"` PageSize int `json:"pageSize"` }
func WrapPageQuery ¶
func WrapPageQuery(ctx context.Context, db *gorm.DB, pp PaginationParam, opts QueryOptions, out any) (*PaginationResult, error)
type QueryOptions ¶
type QueryOptions struct { SelectFields []string OmitFields []string OrderFields OrderByParams }
type ResolverConfig ¶
Click to show internal directories.
Click to hide internal directories.