address

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Index

Constants

This section is empty.

Variables

View Source
var CreateRouter = router.Handler(func(c router.Context) {
	var (
		input CreateAddressParams
	)

	c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response {
		return Create(helper.NewContext(&c), input)
	})
})
View Source
var DeleteRouter = router.Handler(func(c router.Context) {
	id := c.Param("address_id")

	c.ResponseFunc(nil, func() schema.Response {
		return Delete(helper.NewContext(&c), id)
	})
})
View Source
var GetAddressListByUserRouter = router.Handler(func(c router.Context) {
	var (
		input Query
	)

	c.ResponseFunc(c.ShouldBindQuery(&input), func() schema.Response {
		return GetAddressListByUser(helper.NewContext(&c), input)
	})
})
View Source
var GetDefaultRouter = router.Handler(func(c router.Context) {
	c.ResponseFunc(nil, func() schema.Response {
		return GetDefault(helper.NewContext(&c))
	})
})
View Source
var GetDetailRouter = router.Handler(func(c router.Context) {
	id := c.Param("address_id")

	c.ResponseFunc(nil, func() schema.Response {
		return GetDetail(helper.NewContext(&c), id)
	})
})
View Source
var UpdateRouter = router.Handler(func(c router.Context) {
	var (
		input UpdateParams
	)

	id := c.Param("address_id")

	c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response {
		return Update(helper.NewContext(&c), id, input)
	})
})

Functions

func Create

func Create(c helper.Context, input CreateAddressParams) (res schema.Response)

func Delete

func Delete(c helper.Context, addressId string) (res schema.Response)

func DeleteAddressById

func DeleteAddressById(id string)

func GetAddressListByUser

func GetAddressListByUser(c helper.Context, query Query) (res schema.Response)

func GetDefault

func GetDefault(c helper.Context) (res schema.Response)

func GetDetail

func GetDetail(c helper.Context, id string) (res schema.Response)

func Update

func Update(c helper.Context, addressId string, input UpdateParams) (res schema.Response)

Types

type CreateAddressParams

type CreateAddressParams struct {
	Name         string  `json:"name" validate:"required,max=32" comment:"收货人"`                    // 收货人
	Phone        string  `json:"phone" validate:"required,numeric,len=11" comment:"电话号码"`          // 收货人手机号
	ProvinceCode string  `json:"province_code" validate:"required,numeric,len=2" comment:"省份代码"`   // 省份代码
	CityCode     string  `json:"city_code" validate:"required,numeric,len=4" comment:"城市代码"`       // 城市代码
	AreaCode     string  `json:"area_code" validate:"required,numeric,len=6" comment:"区域代码"`       // 区域代码
	StreetCode   string  `json:"street_code" validate:"required,numeric,len=9" comment:"街道/乡/镇代码"` // 街道/乡/镇
	Address      string  `json:"address" validate:"required,max=32" comment:"详细地址"`                // 详细的地址
	IsDefault    *bool   `json:"is_default" validate:"omitempty"`                                  // 是否是默认地址
	Note         *string `json:"note" validate:"omitempty,max=12"`                                 // 备注/标签
}

type Query

type Query struct {
	schema.Query
}

type UpdateParams

type UpdateParams struct {
	Name         *string `json:"name" validate:"omitempty,max=32" comment:"收货人"`                    // 收货人
	Phone        *string `json:"phone" validate:"omitempty,numeric,len=11" comment:"电话号码"`          // 收货人手机号
	ProvinceCode *string `json:"province_code" validate:"omitempty,numeric,len=2" comment:"省份代码"`   // 省份代码
	CityCode     *string `json:"city_code" validate:"omitempty,numeric,len=4" comment:"城市代码"`       // 城市代码
	AreaCode     *string `json:"area_code" validate:"omitempty,numeric,len=6" comment:"区域代码"`       // 区域代码
	StreetCode   *string `json:"street_code" validate:"omitempty,numeric,len=9" comment:"街道/乡/镇代码"` // 街道/乡/镇
	Address      *string `json:"address" validate:"omitempty,max=32" comment:"详细地址"`                // 详细的地址
	IsDefault    *bool   `json:"is_default" omitempty:"omitempty"`                                  // 是否是默认地址
	Note         *string `json:"note" validate:"omitempty,max=12"`                                  // 备注/标签
}

Jump to

Keyboard shortcuts

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