Documentation ¶
Index ¶
- Variables
- func CreateTable(model IModel) error
- func FillInitData(moduleName string, model IModel) error
- func GDBModel(m IModel) *gdb.Model
- func GVartoType(GVar *g.Var, wantType string) interface{}
- func GetDBbyModel(model IModel) *gorm.DB
- func MiddlewareHandlerResponse(r *ghttp.Request)
- func RegisterController(c IController)
- func RegisterControllerSimple(perfix string, controller IControllerSimple)
- type AddReq
- type Admin
- type BaseRes
- type Controller
- func (c *Controller) Add(ctx context.Context, req *AddReq) (res *BaseRes, err error)
- func (c *Controller) Delete(ctx context.Context, req *DeleteReq) (res *BaseRes, err error)
- func (c *Controller) Info(ctx context.Context, req *InfoReq) (res *BaseRes, err error)
- func (c *Controller) List(ctx context.Context, req *ListReq) (res *BaseRes, err error)
- func (c *Controller) Page(ctx context.Context, req *PageReq) (res *BaseRes, err error)
- func (c *Controller) Update(ctx context.Context, req *UpdateReq) (res *BaseRes, err error)
- type ControllerSimple
- type DefaultHandlerResponse
- type DeleteReq
- type IController
- type IControllerSimple
- type IModel
- type IService
- type InfoReq
- type InfoRes
- type ListQueryOp
- type ListReq
- type MGromDBS
- type Model
- type PageReq
- type Service
- func (s *Service) ServiceAdd(ctx context.Context, req *AddReq) (data interface{}, err error)
- func (s *Service) ServiceDelete(ctx context.Context, req *DeleteReq) (data interface{}, err error)
- func (s *Service) ServiceInfo(ctx context.Context, req *InfoReq) (data interface{}, err error)
- func (s *Service) ServiceList(ctx context.Context, req *ListReq) (data interface{}, err error)
- func (s *Service) ServicePage(ctx context.Context, req *PageReq) (data interface{}, err error)
- func (s *Service) ServiceUpdate(ctx context.Context, req *UpdateReq) (data interface{}, err error)
- type UpdateReq
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func MiddlewareHandlerResponse ¶
MiddlewareHandlerResponse is the default middleware handling handler response object and its error.
func RegisterControllerSimple ¶
func RegisterControllerSimple(perfix string, controller IControllerSimple)
注册不带crud的路由
Types ¶
type Admin ¶
type BaseRes ¶
type BaseRes struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
cool.OK 正常返回
type Controller ¶
type Controller struct { Perfix string `json:"perfix"` Api g.ArrayStr `json:"api"` Service IService `json:"service"` }
type ControllerSimple ¶
type ControllerSimple struct {
Perfix string
}
type DefaultHandlerResponse ¶
type DefaultHandlerResponse struct { Code int `json:"code" dc:"Error code"` Message string `json:"message" dc:"Error message"` Data interface{} `json:"data,omitempty" dc:"Result data for certain request according API definition"` }
DefaultHandlerResponse is the default implementation of HandlerResponse.
type IController ¶
type IController interface { Add(ctx context.Context, req *AddReq) (res *BaseRes, err error) Delete(ctx context.Context, req *DeleteReq) (res *BaseRes, err error) Update(ctx context.Context, req *UpdateReq) (res *BaseRes, err error) Info(ctx context.Context, req *InfoReq) (res *BaseRes, err error) List(ctx context.Context, req *ListReq) (res *BaseRes, err error) Page(ctx context.Context, req *PageReq) (res *BaseRes, err error) }
type IControllerSimple ¶
type IControllerSimple interface { }
type IService ¶
type IService interface { ServiceAdd(ctx context.Context, req *AddReq) (data interface{}, err error) ServiceDelete(ctx context.Context, req *DeleteReq) (data interface{}, err error) ServiceUpdate(ctx context.Context, req *UpdateReq) (data interface{}, err error) ServiceInfo(ctx context.Context, req *InfoReq) (data interface{}, err error) ServiceList(ctx context.Context, req *ListReq) (data interface{}, err error) ServicePage(ctx context.Context, req *PageReq) (data interface{}, err error) }
type ListQueryOp ¶
type ListQueryOp struct { FieldEQ []string // 字段等于 KeyWorkField []string // 模糊搜索匹配的数据库字段 AddOrderby g.MapStrStr // 添加排序 }
List接口条件配置
type Model ¶
type Model struct { ID uint `gorm:"primaryKey" json:"id"` CreateTime *time.Time `gorm:"column:createTime;not null;index,priority:1;autoCreateTime:nano;comment:创建时间" json:"createTime"` // 创建时间 UpdateTime *time.Time `gorm:"column:updateTime;not null;index,priority:1;autoUpdateTime:nano;comment:更新时间" json:"updateTime"` // 更新时间 DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"` }
type Service ¶
type Service struct { Model IModel ListQueryOp *ListQueryOp }
func NewService ¶
func (*Service) ServiceAdd ¶
func (*Service) ServiceDelete ¶
func (*Service) ServiceInfo ¶
func (*Service) ServiceList ¶
func (*Service) ServicePage ¶
Click to show internal directories.
Click to hide internal directories.