handler

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

@group account

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountHandler

type AccountHandler struct {
}

func NewAccountHandler

func NewAccountHandler() *AccountHandler

func (*AccountHandler) Login

func (h *AccountHandler) Login(w http.ResponseWriter, r *http.Request)

@title 用户登录接口 @api POST /account/login @request LoginRequest @response 200 common.Response{code=0,msg="success",data=LoginResponse} "登录成功返回数据" @response 200 common.Response{code=10020,msg="password_error"} "密码错误" @author alovn

func (*AccountHandler) Register

func (h *AccountHandler) Register(w http.ResponseWriter, r *http.Request)

@api POST /account/register @title 用户注册接口 @request RegisterRequest @header x-request-id string false "request id" @query from string false "test" @response 200 common.Response{code=0,msg="success",data=RegisterResponse} "注册成功返回数据" @response 200 common.Response{code=10011,msg="password format error"} "密码格式错误" @author alovn @desc 用户注册接口说明 @order -1

type AddressHandler

type AddressHandler struct {
}

func NewAddressHandler

func NewAddressHandler() *AddressHandler

func (*AddressHandler) Create

func (h *AddressHandler) Create(w http.ResponseWriter, r *http.Request)

@api POST /address/create @title 添加地址接口 @group address @request CreateAddressRequest @response 200 common.Response{code=0,msg="success"} @author alovn

func (*AddressHandler) Delete

func (h *AddressHandler) Delete(w http.ResponseWriter, r *http.Request)

@api POST /address/delete @title 删除地址接口 @group address @request DeleteAddressRequest @response 200 common.Response{code=0,msg="success"} @author alovn

func (*AddressHandler) Get

@api GET /address/get/:id @title 获取地址信息 @group address @request GetAddressRequest @response 200 common.Response{code=0,msg="success",data=AddressResponse} @author alovn

func (*AddressHandler) List

@api GET /address/list @title 获取地址列表 @group address @response 200 common.Response{code=0,msg="success",data=[]AddressResponse} @author alovn @desc 获取收货地址列表 Deprecated: or use @deprecated

func (*AddressHandler) Time

@api GET /demo/time @title time @group demo @accept xml @format json @response 200 common.Response{code=0,msg="success",data=DemoTime} @author alovn

func (*AddressHandler) Update

func (h *AddressHandler) Update(w http.ResponseWriter, r *http.Request)

@api POST /address/update @title 更新地址接口 @group address @request UpdateAddressRequest @response 200 common.Response{code=0,msg="success"} @author alovn

func (*AddressHandler) XML

@api GET /demo/xml @title xml @group demo @accept xml @request DemoXMLRequest @format xml @response 200 common.Response{code=0,msg="success",data=DemoXMLResponse} @response 200 common.Response{code=0,msg="success",data=DemoXMLResponse2} @response 200 common.Response{code=10010,msg="sme error"} @author alovn

type AddressResponse

type AddressResponse struct {
	ID      int64  `json:"id,omitempty"`      //地址ID
	CityID  int64  `json:"city_id,omitempty"` //城市ID
	Address string `json:"address,omitempty"` //地址信息

} //返回地址信息

type CreateAddressRequest

type CreateAddressRequest struct {
	CityID  int64  `form:"city_id" validate:"required" json:"city_id,omitempty"` //城市ID
	Address string `form:"address" validate:"required" json:"address,omitempty"` //地址

} //添加地址请求参数

type DeleteAddressRequest

type DeleteAddressRequest struct {
	ID int64 `form:"id" validate:"required"` //地址ID

} //添加地址请求参数

type DemoData

type DemoData struct {
	Title       string         `json:"title,omitempty"` //标题
	Description string         `json:"description,omitempty"`
	Count       int            `json:"count,omitempty"`
	IntArray    []int          `json:"int_array,omitempty"`
	FloatArray  []float64      `json:"float_array,omitempty"`
	IntPointer  *int           `json:"int_pointer,omitempty"`
	Map         map[string]int `json:"map,omitempty"`
	Object1     DemoObject     `json:"object_1,omitempty"`
	Object2     *DemoObject    `json:"object_2,omitempty"`
}

type DemoHandler

type DemoHandler struct{}

func NewDemoHandler

func NewDemoHandler() *DemoHandler

func (*DemoHandler) Int

func (h *DemoHandler) Int(w http.ResponseWriter, r *http.Request)

@api GET /demo/int @title int @group demo @response 200 int "demo int"

func (*DemoHandler) IntArray

func (h *DemoHandler) IntArray(w http.ResponseWriter, r *http.Request)

@api GET /demo/int_array @title int数组 @group demo @response 200 []int "demo int array"

func (*DemoHandler) Map

func (h *DemoHandler) Map(w http.ResponseWriter, r *http.Request)

@api GET /demo/map @title map @group demo @response 200 DemoMap "demo map"

func (*DemoHandler) StructArray

func (h *DemoHandler) StructArray(w http.ResponseWriter, r *http.Request)

@api GET /demo/struct_array @title struct数组 @group demo @response 200 []DemoData "demo struct array" @version 1.0.2.1

func (*DemoHandler) StructNested

func (h *DemoHandler) StructNested(w http.ResponseWriter, r *http.Request)

@api GET /demo/struct_nested @title struct嵌套 @group demo @response 200 Struct1 "nested struct"

type DemoMap

type DemoMap map[string]DemoData

type DemoObject

type DemoObject struct {
	Name string `json:"name,omitempty"`
}

type DemoTime

type DemoTime struct {
	// Title string    //测试
	Time1 time.Time `xml:"time_1" json:"time_1"`                               //example1
	Time2 time.Time `xml:"time_2" json:"time_2" example:"2022-05-14 15:04:05"` //example2
	Time3 MyTime    `xml:"time_3" json:"time_3"`
}

type DemoXMLRequest

type DemoXMLRequest struct {
	XMLName xml.Name `xml:"request"`
	ID      int64    `param:"id" xml:"id"` //DemoID

} //XML测试请求对象

type DemoXMLResponse

type DemoXMLResponse struct {
	XMLName xml.Name `xml:"demo"`
	ID      int64    `xml:"id"`      //地址ID
	CityID  int64    `xml:"city_id"` //城市ID
	Address string   `xml:"address"` //地址信息

} //XML测试返回对象

type DemoXMLResponse2

type DemoXMLResponse2 struct {
	ID      int64  `xml:"id"`      //地址ID
	CityID  int64  `xml:"city_id"` //城市ID
	Address string `xml:"address"` //地址信息

} //XML测试返回对象2

type GetAddressRequest

type GetAddressRequest struct {
	ID int64 `param:"id"` //地址ID

} //获取地址请求参数

type LoginRequest

type LoginRequest struct {
	Username     string `form:"username" validate:"required"` //登录用户名
	Password     string `form:"password" validate:"required"` //登录密码
	ValidateCode string `form:"validate_code"`                //验证码

} //登录请求参数

type LoginResponse

type LoginResponse struct {
	WelcomeMsg string `json:"welcome_msg,omitempty"` //登录成功欢迎语

} //登录返回数据
type MenuHandler struct{}

func NewMenuHandler

func NewMenuHandler() *MenuHandler
func (h *MenuHandler) Nodes(w http.ResponseWriter, r *http.Request)

@api GET /menu/nodes @title 获取菜单节点 @group menu @response 200 common.Response{code=0,msg="success",data=[]Node} @author alovn @desc 测试数组、递归结构体

type MyTime

type MyTime time.Time

type Node

type Node struct {
	ID    int64  `json:"id"`
	Name  string `json:"name"`
	Nodes []Node `json:"nodes"`
}

type ProfileHandler

type ProfileHandler struct {
}

func NewProfileHandler

func NewProfileHandler() *ProfileHandler

func (*ProfileHandler) Get

@api GET /profile/get @title 获取用户资料 @group profile @response 200 common.Response{code=0,msg="success",data=ProfileResponse} @author alovn

type ProfileResponse

type ProfileResponse struct {
	Username string            `json:"username,omitempty"`
	Gender   uint8             `json:"gender,omitempty" example:"1"`
	Extends  map[string]string `json:"extends,omitempty"` //扩展信息
}

type RegisterRequest

type RegisterRequest struct {
	Username string `form:"username" validate:"required" json:"username,omitempty"` //用户名
	Password string `form:"password" validate:"required" json:"password,omitempty"` //密码

} //注册请求参数

type RegisterResponse

type RegisterResponse struct {
	Username   string `json:"username,omitempty"`    //注册的用户名
	UserID     int64  `json:"user_id,omitempty"`     //注册的用户ID
	WelcomeMsg string `json:"welcome_msg,omitempty"` //注册后的欢迎语

} //注册返回数据

type Struct1

type Struct1 struct {
	Name string
	Struct2
}

type Struct2

type Struct2 struct {
	Name2 string
}

type UpdateAddressRequest

type UpdateAddressRequest struct {
	ID      int64  `form:"id" validate:"required"`      //地址ID
	Address string `form:"address" validate:"required"` //地址

} //添加地址请求参数

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL