api

package
v0.0.0-...-8b2948b Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2017 License: MIT Imports: 6 Imported by: 0

README

rustful api

/sign_in

headers

method: post

Content-Type: application/x-www-form-urlencoded

body

name     string
password string

/sign_up

headers

method: post
Content-Type: application/x-www-form-urlencoded 

body

name                      string
password                  string
new_password_confirmation string

/renew_password

headers

method: post
Content-Type: application/x-www-form-urlencoded 

body

name                      string
password                  string
new_password              string
new_password_confirmation string

/sign_out

method: post

limit

authorization required

/takeout

headers

method: post
Content-Type: application/json

body

{
	authuser: string
	address:  string
	tag:      string
	items: [{
		name: string
		price: uint
		num: int
	}]
}

limit

authorization required

/order

headers

method: post
Content-Type: application/json

body

{
	order_id: string
}

/order_list

headers

method: post
Content-Type: application/json

body

{
	start: iso 8601 time format string
	end: iso 8601 time format string
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RequestBind = []func(*Api, *gin.Engine){}

Functions

func Create

func Create(db *gorm.DB, cachemanage *cachemanage.Manage, needlogin bool) *gin.Engine

Types

type Api

type Api struct {
	DB        *gorm.DB
	Cache     *cachemanage.Manage
	NeedLogin bool
}

func (*Api) AuthRequired

func (a *Api) AuthRequired(c *gin.Context)

func (*Api) Authorized

func (a *Api) Authorized(c *gin.Context)

func (*Api) Close

func (api *Api) Close()

func (*Api) Order

func (a *Api) Order(c *gin.Context)

func (*Api) OrderList

func (a *Api) OrderList(c *gin.Context)

func (*Api) RePass

func (a *Api) RePass(c *gin.Context)

renew password

func (*Api) SignIn

func (a *Api) SignIn(c *gin.Context)

func (*Api) SignUp

func (a *Api) SignUp(c *gin.Context)

func (*Api) Takeout

func (a *Api) Takeout(c *gin.Context)

func (*Api) UnAuthorized

func (a *Api) UnAuthorized(c *gin.Context)

type ReqDataOrder

type ReqDataOrder struct {
	OrderId uint `json:"order_id" binding:"required"`
}

type ReqDataOrderList

type ReqDataOrderList struct {
	Start time.Time `json:"start" binding:"required"`
	End   time.Time `json:"end" binding:"required"`
}

type ReqDataRePass

type ReqDataRePass struct {
	Name           string `json:"name" form:"name" binding:"required"`
	Pass           string `json:"password" form:"password" binding:"required"`
	NewPass        string `json:"new_password" form:"new_password" binding:"required"`
	NewPassConfirm string `json:"new_password_confirmation" form:"new_password_confirmation" binding:"required"`
}

type ReqDataSignIn

type ReqDataSignIn struct {
	Name string `json:"name" form:"name" binding:"required"`
	Pass string `json:"password" form:"password" binding:"required"`
}

type ReqDataSignUp

type ReqDataSignUp struct {
	Name        string `json:"name" form:"name" binding:"required"`
	Pass        string `json:"password" form:"password" binding:"required"`
	PassConfirm string `json:"password_confirmation" form:"password_confirmation" binding:"required"`
}

type ReqDataTakeOut

type ReqDataTakeOut struct {
	AuthUser string        `json:"authuser" binding:"required"`
	Address  string        `json:"address" binding:"required"`
	Tag      string        `json:"tag"`
	Items    []TakeOutItem `json:"items"`
}

type RespDataOrderList

type RespDataOrderList struct {
	gorm.Model
	ShopAddr string
	Tag      string
	User     *definition.User
}

type RespDataTakeout

type RespDataTakeout struct {
	OrderId uint `json:"order_id" binding:"required"`
}

type TakeOutItem

type TakeOutItem struct {
	Name  string `json:"name"`
	Price uint   `json:"price"`
	Num   int    `json:"num"`
}

Jump to

Keyboard shortcuts

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