Documentation
¶
Index ¶
- func Handle(h HandlerFunc) gin.HandlerFunc
- type Context
- func (c *Context) BadRequest(err error)
- func (c *Context) BuildQuery(structP any) (string, []any, error)
- func (c *Context) GetIDList() (IDList, error)
- func (c *Context) InternalErr(err error)
- func (c *Context) Paging() (Paging, error)
- func (c *Context) Success()
- func (c *Context) SuccessWith(r Response)
- type HandlerFunc
- type IDList
- type Paging
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handle ¶
func Handle(h HandlerFunc) gin.HandlerFunc
Types ¶
type Context ¶
func (*Context) BadRequest ¶
func (*Context) BuildQuery ¶
BuildQuery build and validate query param to struct, struct param is pointer form tag is query param and json tag is table column name
type Temp struct { Name string `form:"name" json:"name"` ID []uint `form:"id[]" json:"id"` }
query url ?name=tom&id[]=1&id[]=2 will generate ("name = ? AND id IN ?", "tom", []uint(1,2))
created_at is a special tag and every table must have created_at column see `service/bill/details/list.go` for more example
func (*Context) InternalErr ¶
func (*Context) SuccessWith ¶
type HandlerFunc ¶
type HandlerFunc func(c *Context)
Click to show internal directories.
Click to hide internal directories.