charge

package
v0.0.0-...-4aec9fb Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelayingLimiterMiddleware

func DelayingLimiterMiddleware(limit ratelimit.Waiter) endpoint.Middleware

此函数并没有使用,函数已在go-kit包中实现

func MakeDeleteEndpoint

func MakeDeleteEndpoint(s ChargeService) endpoint.Endpoint

MakeDeleteEndpoint returns an endpoint that invokes Delete on the service.

func MakeGetAllEndpoint

func MakeGetAllEndpoint(s ChargeService) endpoint.Endpoint

MakeGetAllEndpoint returns an endpoint that invokes GetAll on the service.

func MakeGetAllOfUserEndpoint

func MakeGetAllOfUserEndpoint(s ChargeService) endpoint.Endpoint

func MakeGetSpecEndpoint

func MakeGetSpecEndpoint(s ChargeService) endpoint.Endpoint

MakeGetSpecEndpoint returns an endpoint that invokes GetSpec on the service.

func MakePostEndpoint

func MakePostEndpoint(s ChargeService) endpoint.Endpoint

MakePostEndpoint returns an endpoint that invokes Post on the service.

Types

type ChargeService

type ChargeService interface {
	// 查询所有充值记录
	GetAll(ctx context.Context, page, offset, limit int, orderby string) (status bool, errinfo string, data []model.Charge)
	// 查询某个充值记录
	GetSpec(ctx context.Context, chargeId string) (status bool, errinfo string, data interface{})
	// 充值操作
	Post(ctx context.Context, charge interface{}) (status bool, errinfo string, data interface{})
	// 删除充值记录
	Delete(ctx context.Context, chargeId string) (status bool, errinfo string, data *model.Charge)
	// 查询用户相关记录
	GetAllOfUser(ctx context.Context, userId string, page, offset, limit int, orderby string) (status bool, errinfo string, data []model.Charge)
}

func NewBasicChargeService

func NewBasicChargeService(conf string) ChargeService

NewBasicChargeService returns a naive, stateless implementation of ChargeService.

type Decodes

type Decodes struct {
	GetSpecDecode      func(ctx context.Context, r *http.Request) (interface{}, error)
	GetAllDecode       func(ctx context.Context, r *http.Request) (interface{}, error)
	PostDecode         func(ctx context.Context, r *http.Request) (interface{}, error)
	DeleteDecode       func(ctx context.Context, r *http.Request) (interface{}, error)
	GetAllOfUserDecode func(ctx context.Context, r *http.Request) (interface{}, error)
}

func MakeServerDecodes

func MakeServerDecodes() Decodes

type Encodes

type Encodes struct {
	GetSpecEncode      func(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
	GetAllEncode       func(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
	PostEncode         func(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
	DeleteEncode       func(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
	GetAllOfUserEncode func(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
}

func MakeServerEncodes

func MakeServerEncodes() Encodes

type Endpoints

type Endpoints struct {
	GetSpecEndpoint      endpoint.Endpoint
	GetAllEndpoint       endpoint.Endpoint
	GetAllOfUserEndpoint endpoint.Endpoint
	PostEndpoint         endpoint.Endpoint
	DeleteEndpoint       endpoint.Endpoint
}

func MakeServerEndpoints

func MakeServerEndpoints(s ChargeService) Endpoints

type InstrumentingMiddleware

type InstrumentingMiddleware struct {
	RequestCount   metrics.Counter
	RequestLatency metrics.Histogram
	Next           ChargeService
}

func (*InstrumentingMiddleware) Delete

func (i *InstrumentingMiddleware) Delete(ctx context.Context, chargeId string) (status bool, errinfo string, data *model.Charge)

func (*InstrumentingMiddleware) GetAll

func (i *InstrumentingMiddleware) GetAll(ctx context.Context, page, offset, limit int, orderby string) (status bool, errinfo string, data []model.Charge)

func (*InstrumentingMiddleware) GetAllOfUser

func (i *InstrumentingMiddleware) GetAllOfUser(ctx context.Context, userId string, page, offset, limit int, orderby string) (status bool, errinfo string, data []model.Charge)

func (*InstrumentingMiddleware) GetSpec

func (i *InstrumentingMiddleware) GetSpec(ctx context.Context, chargeId string) (status bool, errinfo string, data interface{})

func (*InstrumentingMiddleware) Post

func (i *InstrumentingMiddleware) Post(ctx context.Context, charge interface{}) (status bool, errinfo string, data interface{})

type LoggingMiddleware

type LoggingMiddleware struct {
	Logger log.Logger
	Next   ChargeService
}

log middleware

func (*LoggingMiddleware) Delete

func (l *LoggingMiddleware) Delete(ctx context.Context, chargeId string) (status bool, errinfo string, data *model.Charge)

func (*LoggingMiddleware) GetAll

func (l *LoggingMiddleware) GetAll(ctx context.Context, page, offset, limit int, orderby string) (status bool, errinfo string, data []model.Charge)

func (*LoggingMiddleware) GetAllOfUser

func (l *LoggingMiddleware) GetAllOfUser(ctx context.Context, userId string, page, offset, limit int, orderby string) (status bool, errinfo string, data []model.Charge)

func (*LoggingMiddleware) GetSpec

func (l *LoggingMiddleware) GetSpec(ctx context.Context, chargeId string) (status bool, errinfo string, data interface{})

func (*LoggingMiddleware) Post

func (l *LoggingMiddleware) Post(ctx context.Context, charge interface{}) (status bool, errinfo string, data interface{})

type Request

type Request struct {
	ChargeId string      `json:"chargeId"`
	Charge   interface{} `json:"charge"`
	UserId   string      `json:"userId"`
	Page     int         `json:"page"`
	Offset   int         `json:"offset"`
	Limit    int         `json:"limit"`
	Orderby  string      `json:"orderby"`
}

Request collects the request parameters for the All method.

type Response

type Response struct {
	Status  bool        `json:"status"`
	Errinfo string      `json:"errinfo"`
	Data    interface{} `json:"data"`
}

Response collects the response parameters for the All method.

Directories

Path Synopsis
money-hub MoneyDodo/charge This documentation describes example APIs found under https://github.com/money-hub/MoneyDodo.service Schemes: http Version: 1.0.0 License: MIT http://opensource.org/licenses/MIT Consumes: - application/json Produces: - application/json Security: - bearer SecurityDefinitions: bearer: type: apiKey name: Authorization in: header swagger:meta
money-hub MoneyDodo/charge This documentation describes example APIs found under https://github.com/money-hub/MoneyDodo.service Schemes: http Version: 1.0.0 License: MIT http://opensource.org/licenses/MIT Consumes: - application/json Produces: - application/json Security: - bearer SecurityDefinitions: bearer: type: apiKey name: Authorization in: header swagger:meta

Jump to

Keyboard shortcuts

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