Documentation ¶
Index ¶
- func DelayingLimiterMiddleware(limit ratelimit.Waiter) endpoint.Middleware
- func MakeDeleteEndpoint(s ChargeService) endpoint.Endpoint
- func MakeGetAllEndpoint(s ChargeService) endpoint.Endpoint
- func MakeGetAllOfUserEndpoint(s ChargeService) endpoint.Endpoint
- func MakeGetSpecEndpoint(s ChargeService) endpoint.Endpoint
- func MakePostEndpoint(s ChargeService) endpoint.Endpoint
- type ChargeService
- type Decodes
- type Encodes
- type Endpoints
- type InstrumentingMiddleware
- func (i *InstrumentingMiddleware) Delete(ctx context.Context, chargeId string) (status bool, errinfo string, data *model.Charge)
- func (i *InstrumentingMiddleware) GetAll(ctx context.Context, page, offset, limit int, orderby string) (status bool, errinfo string, data []model.Charge)
- func (i *InstrumentingMiddleware) GetAllOfUser(ctx context.Context, userId string, page, offset, limit int, orderby string) (status bool, errinfo string, data []model.Charge)
- func (i *InstrumentingMiddleware) GetSpec(ctx context.Context, chargeId string) (status bool, errinfo string, data interface{})
- func (i *InstrumentingMiddleware) Post(ctx context.Context, charge interface{}) (status bool, errinfo string, data interface{})
- type LoggingMiddleware
- func (l *LoggingMiddleware) Delete(ctx context.Context, chargeId string) (status bool, errinfo string, data *model.Charge)
- func (l *LoggingMiddleware) GetAll(ctx context.Context, page, offset, limit int, orderby string) (status bool, errinfo string, data []model.Charge)
- func (l *LoggingMiddleware) GetAllOfUser(ctx context.Context, userId string, page, offset, limit int, orderby string) (status bool, errinfo string, data []model.Charge)
- func (l *LoggingMiddleware) GetSpec(ctx context.Context, chargeId string) (status bool, errinfo string, data interface{})
- func (l *LoggingMiddleware) Post(ctx context.Context, charge interface{}) (status bool, errinfo string, data interface{})
- type Request
- type Response
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) GetAllOfUser ¶
type LoggingMiddleware ¶
type LoggingMiddleware struct { Logger log.Logger Next ChargeService }
log middleware
func (*LoggingMiddleware) GetAllOfUser ¶
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.
Source Files ¶
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 |
Click to show internal directories.
Click to hide internal directories.