Documentation ¶
Index ¶
- type APIError
- type Context
- func (c *Context) DelStruct3(rw web.ResponseWriter, req *web.Request)
- func (c *Context) GetSameStructArraryByString(rw web.ResponseWriter, req *web.Request)
- func (c *Context) GetSimpleArrayByString(rw web.ResponseWriter, req *web.Request)
- func (c *Context) GetStringByInt(rw web.ResponseWriter, req *web.Request)
- func (c *Context) GetStruct2ByInt(rw web.ResponseWriter, req *web.Request)
- func (c *Context) GetStructArrayByString(rw web.ResponseWriter, req *web.Request)
- func (c *Context) GetStructByInt(rw web.ResponseWriter, req *web.Request)
- func (c *Context) PostStruct3(rw web.ResponseWriter, req *web.Request)
- func (c *Context) WriteResponse(response interface{})
- type SimpleStructure
- type SimpleStructureWithAnnotations
- type StructureWithAnonymousStructure
- type StructureWithEmbededPointer
- type StructureWithEmbededStructure
- type StructureWithSlice
- type TypeInterface
- type TypeString
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
Response interface{}
}
@Name testapi @Description test apis
func (*Context) DelStruct3 ¶
func (c *Context) DelStruct3(rw web.ResponseWriter, req *web.Request)
@Title GetStruct3 @Summary get struct3 summary @Description get struct3 desc @Consumes json @Produces json @Success 200 SimpleStructure "Success" @Success 201 SimpleStructure "Success" @Failure 400 APIError "We need ID!!" @Failure 404 APIError "Can not find ID" @Router DELETE /testapi/get-struct3
func (*Context) GetSameStructArraryByString ¶
func (c *Context) GetSameStructArraryByString(rw web.ResponseWriter, req *web.Request)
@Title SameStruct @Summary get struct array by ID @Description get struct array by ID @Consumes json @Produces json @Param some_id path string true "Some ID" @Param offset query int true "Offset" @Param body body []SimpleStructure true "Body" @Param limit query int true "Limit" @Success 200 []SimpleStructure "Success" @Failure 400 APIError "We need ID!!" @Failure 404 APIError "Can not find ID" @Router PUT /testapi/get-same-struct-array-by-string/{some_id}
func (*Context) GetSimpleArrayByString ¶
func (c *Context) GetSimpleArrayByString(rw web.ResponseWriter, req *web.Request)
@Title GetSimpleArrayByString @Summary get simple array by ID @Description get simple array by ID @Consumes json @Produces json @Param some_id path string true "Some ID" @Param offset query int true "Offset" @Param limit query int true "Limit" @Success 200 []string "Success" @Failure 400 APIError "We need ID!!" @Failure 404 APIError "Can not find ID" @Router POST /testapi/get-simple-array-by-string/{some_id}
func (*Context) GetStringByInt ¶
func (c *Context) GetStringByInt(rw web.ResponseWriter, req *web.Request)
Title unique id @Title GetStringByInt
Deprecated show if this method has been deprecated @Deprecated true
Summary short explain it's action @Summary get string by ID summary @Summary multi line
Description long explain about implement @Description get string by ID desc @Description multi line
Consumes type include(json,plain,xml) @Consumes json,plain,xml,html
Produces type include(json,plain,xml,html) @Produces json,plain,xml,html
Param:param_name/param_type/data_type/required(optional)/describtion(optional)/defaul_value(optional) value == "-" means optional form and body params cann't coexist path param must be required if file type param exsited, all params must be form except path and query @Param path_param path int - "Some ID" 123 @Param form_param form file - "Request Form" @Param body_param body string - "Request Body" @Param body_param_2 body string - "Request Body" @Param query_param query []string - "Array" @Param query_param_2 query [][]string - "Array Array"
Success:response_code/data_type(optional)/describtion(optional) @Success 200 string "Success" @Success 201 SubStructDot "Success" @Success 202 sub.SubStructAlias "Success" @Success 203 StructureWithAnonymousStructure @Success 204 map[string]string
Failure:response_code/data_type(optional)/describtion(optional) @Failure 400 APIError "We need ID!!" @Failure 404 APIError "Can not find ID"
Router:http_method/api_path @Router GET /testapi/get-string-by-int/{some_id}
func (*Context) GetStruct2ByInt ¶
func (c *Context) GetStruct2ByInt(rw web.ResponseWriter, req *web.Request)
@Title GetStruct2ByInt @Summary get struct2 by ID @Description get struct2 by ID @Consumes json @Produces json @Param some_id path int true "Some ID" @Param offset query int true "Offset" @Param limit query int true "Limit" @Success 200 StructureWithEmbededPointer "Success" @Failure 400 APIError "We need ID!!" @Failure 404 APIError "Can not find ID" @Router GET /testapi/get-struct2-by-int/{some_id}
func (*Context) GetStructArrayByString ¶
func (c *Context) GetStructArrayByString(rw web.ResponseWriter, req *web.Request)
@Title GetStructArrayByString @Summary get struct array by ID @Description get struct array by ID @Consumes json @Produces json @Param some_id path string true "Some ID" "hello world" @Param body body subpackage.SimpleStructure true @Param limit query int true "Limit" @Success 200 []subpackage.SimpleStructure "Success" @Failure 400 APIError "We need ID!!" @Failure 404 APIError "Can not find ID" @Router PUT /testapi/get-struct-array-by-string/{some_id}
func (*Context) GetStructByInt ¶
func (c *Context) GetStructByInt(rw web.ResponseWriter, req *web.Request)
@Title GetStructByInt @Summary get struct by ID @Description get struct by ID @Consumes json @Produces json @Param some_id path int true "Some ID" @Param offset query int true "Offset" @Param limit query int true "Limit" @Success 200 StructureWithEmbededStructure "Success" @Failure 400 APIError "We need ID!!" @Failure 404 APIError "Can not find ID" @Router GET /testapi/get-struct-by-int/{some_id}
func (*Context) PostStruct3 ¶
func (c *Context) PostStruct3(rw web.ResponseWriter, req *web.Request)
@Title GetStruct3 @Summary get struct3 @Description get struct3 @Consumes json @Produces json @Success 204 - "null" @Success 200 StructureWithSlice "Success" @Success 201 TypeInterface "Success" @Failure 400 APIError "We need ID!!" @Failure 404 APIError "Can not find ID" @Router POST /testapi/get-struct3
func (*Context) WriteResponse ¶
func (c *Context) WriteResponse(response interface{})
type SimpleStructure ¶
type SimpleStructure struct { Id float32 `json:"id" swaggo:"true,dfsdfdsf,19"` Name string `json:"name" swaggo:"true,,xus"` Age int `json:"age" swaggo:"true,the user age,18"` CTime time.Time `json:"ctime" swaggo:"true,create time"` Sub subpackage.SimpleStructure `json:"sub" swaggo:"true"` I TypeInterface `json:"i" swaggo:"true"` T TypeString `json:"t"` Map map[string]string `json:"map", swaggo:",map type"` }
type StructureWithAnonymousStructure ¶
type StructureWithAnonymousStructure struct { Anonymous []struct { Name string StructureWithSlice Anonymous []struct { Name string } } }
type StructureWithEmbededPointer ¶
type StructureWithEmbededPointer struct {
*StructureWithSlice
}
type StructureWithEmbededStructure ¶
type StructureWithEmbededStructure struct {
SimpleStructure
}
hello
type StructureWithSlice ¶
type TypeInterface ¶
type TypeInterface interface {
Hello()
}
type TypeString ¶
type TypeString string