Documentation ¶
Overview ¶
Package model provides common request and response models.
// UserRequest is the request body type UserRequest struct { model.RequestBody // annotation RequestBody Username string `validate:"required"` Password string `validate:"required"` }
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // RequestTypeBody means it is RequestBody RequestTypeBody = "RequestBody" // RequestTypeParams means it is RequestParams RequestTypeParams = "RequestParams" // RequestTypeForm means it is RequestForm RequestTypeForm = "RequestForm" // Context means it is Context Context = "Context" )
Functions ¶
This section is empty.
Types ¶
type BaseData ¶ added in v1.5.0
type BaseData struct { // IsDeleted for soft delete IsDeleted bool `json:"is_deleted,omitempty"` // CreatedAt data created time CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt data updated time UpdatedAt time.Time `json:"updated_at,omitempty"` }
BaseData specifies the base data fields for database models
type BaseResponse ¶ added in v0.2.0
type BaseResponse struct { BaseResponseInfo Data interface{} `json:"data,omitempty" schema:"HTTP response data"` }
BaseResponse is the implementation of rest controller's Response
func (*BaseResponse) GetData ¶ added in v0.2.0
func (r *BaseResponse) GetData() interface{}
GetData get data
func (*BaseResponse) SetData ¶ added in v0.2.0
func (r *BaseResponse) SetData(data interface{})
SetData the data will be serialized to json string
type BaseResponseInfo ¶ added in v1.5.0
type BaseResponseInfo struct { at.Schema Code int `json:"code" schema:"HTTP response code"` Message string `json:"message,omitempty" schema:"HTTP response message"` }
BaseResponseInfo is the implementation of rest controller's Response
func (*BaseResponseInfo) GetCode ¶ added in v1.5.0
func (r *BaseResponseInfo) GetCode() int
GetCode get error code
func (*BaseResponseInfo) GetMessage ¶ added in v1.5.0
func (r *BaseResponseInfo) GetMessage() string
GetMessage get message
func (*BaseResponseInfo) SetCode ¶ added in v1.5.0
func (r *BaseResponseInfo) SetCode(code int)
SetCode set error code
func (*BaseResponseInfo) SetMessage ¶ added in v1.5.0
func (r *BaseResponseInfo) SetMessage(message string)
SetMessage set message
type ListOptions ¶ added in v1.5.0
type ListOptions struct { // For paginated result sets, page of results to retrieve. Page int `url:"page,omitempty" json:"page,omitempty" validate:"min=1"` // For paginated result sets, the number of results to include per page. PerPage int `url:"per_page,omitempty" json:"per_page,omitempty" validate:"min=1"` }
ListOptions specifies the optional parameters to various List methods that support pagination.
type RequestBody ¶ added in v0.2.0
type RequestBody struct {
at.RequestBody
}
RequestBody the annotation RequestBody
type RequestForm ¶ added in v0.2.0
type RequestForm struct {
at.RequestForm
}
RequestForm the annotation RequestForm
type RequestParams ¶ added in v0.2.0
type RequestParams struct {
at.RequestParams
}
RequestParams the annotation RequestParams
type Response ¶
type Response interface { ResponseInfo // Set data, the data will be serialized to json string SetData(data interface{}) // Get data GetData() interface{} }
Click to show internal directories.
Click to hide internal directories.