Documentation
¶
Index ¶
- Variables
- func GormErrorAs(gorm *gorm.DB) error
- func MakeCondition(params any, gorm *gorm.DB) *gorm.DB
- type Api
- func (e *Api) Errors(err error) types.IApiResult
- func (e *Api) Failure(data ...any) types.IApiResult
- func (e *Api) HttpCode(code int) types.IApiResult
- func (e *Api) Json(data ...any) types.IApiResult
- func (e *Api) Jsonp(data ...any) types.IApiResult
- func (e *Api) Null() types.IApiResult
- func (e *Api) Redirect() types.IApiResult
- func (e *Api) Result(api types.IApiResult, data ...any) types.IApiResult
- func (e *Api) String(data ...any) types.IApiResult
- func (e *Api) Success(data ...any) types.IApiResult
- func (e *Api) View(name string, data fiber.Map) types.IApiResult
- func (e *Api) Xml(data ...any) types.IApiResult
- type IRouter
- type Router
- func (r *Router) DELETE(relativePath string, handlers any)
- func (r *Router) Exec(c *fiber.Ctx, method string, handlers any) error
- func (r *Router) GET(relativePath string, handlers any)
- func (r *Router) Group(relativePath string) *Router
- func (r *Router) Options(relativePath string, handlers any)
- func (r *Router) POST(relativePath string, handlers any)
- func (r *Router) Put(relativePath string, handlers any)
- type Service
- func (s *Service[T, R]) Cache(ttl int64) *Service[T, R]
- func (s *Service[T, R]) Create(data *T, omits ...string) *errors.Message
- func (s *Service[T, R]) DB() *gorm.DB
- func (s *Service[T, R]) Delete(id uint, omits ...string) *errors.Message
- func (s *Service[T, R]) Destroy(id uint, omits ...string) *errors.Message
- func (s *Service[T, R]) FindByField(field string, value any) (result *R, err *errors.Message)
- func (s *Service[T, R]) FindByFields(fields any) (result *R, err *errors.Message)
- func (s *Service[T, R]) FindById(id uint) (result *R, err *errors.Message)
- func (s *Service[T, R]) GetCacheDb(ttl int64) *gorm.DB
- func (s *Service[T, R]) GetDb(dbName string) *gorm.DB
- func (s *Service[T, R]) GetReadDb() *gorm.DB
- func (s *Service[T, R]) GetWriteDb() *gorm.DB
- func (s *Service[T, R]) Search(page int, pageSize int, params any) (*TPage[R], *errors.Message)
- func (s *Service[T, R]) Update(id uint, data *T, omits ...string) *errors.Message
- func (s *Service[T, R]) WithContext(c *fiber.Ctx) *errors.Message
- type TPage
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Api ¶
type Api struct { }
func (*Api) Errors ¶
func (e *Api) Errors(err error) types.IApiResult
func (*Api) HttpCode ¶
func (e *Api) HttpCode(code int) types.IApiResult
func (*Api) Json ¶
func (e *Api) Json(data ...any) types.IApiResult
func (*Api) Jsonp ¶
func (e *Api) Jsonp(data ...any) types.IApiResult
func (*Api) Null ¶
func (e *Api) Null() types.IApiResult
func (*Api) Redirect ¶
func (e *Api) Redirect() types.IApiResult
func (*Api) Result ¶
func (e *Api) Result(api types.IApiResult, data ...any) types.IApiResult
func (*Api) String ¶
func (e *Api) String(data ...any) types.IApiResult
func (*Api) View ¶
func (e *Api) View(name string, data fiber.Map) types.IApiResult
func (*Api) Xml ¶
func (e *Api) Xml(data ...any) types.IApiResult
type Router ¶
type Router struct { Engine *fiber.App Router fiber.Router }
type Service ¶
type Service[T any, R any] struct { Data T Ctx *fiber.Ctx // contains filtered or unexported fields }
Service 服务
func (*Service[T, R]) Create ¶
Create 创建 omits 忽略字段
func (*Service[T, R]) Delete ¶
Delete 删除 omits 忽略字段
func (*Service[T, R]) Destroy ¶
Destroy 彻底删除 omits 忽略字段
func (*Service[T, R]) FindByField ¶
FindByField 获取信息
func (*Service[T, R]) FindByFields ¶
FindByFields 获取信息
func (*Service[T, R]) FindById ¶
FindById 获取信息
func (*Service[T, R]) Search ¶
Search 分页查询
func (*Service[T, R]) Update ¶
Update 更新信息 omits 忽略字段
Click to show internal directories.
Click to hide internal directories.