Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func MakeGetLastEndpoint ¶
func MakeHTTPHandler ¶
func MakeHTTPHandler(e EndpointSet, logger log.Logger) http.Handler
func MakeSpinEndpoint ¶
Types ¶
type EndpointSet ¶
func MakeClientEndpoints ¶
func MakeClientEndpoints(instance string) (EndpointSet, error)
func MakeServerEndpoints ¶
func MakeServerEndpoints(svc Service) EndpointSet
func (*EndpointSet) GetLast ¶
func (e *EndpointSet) GetLast(ctx context.Context) (SpinResult, error)
func (*EndpointSet) Spin ¶
func (e *EndpointSet) Spin(ctx context.Context, participantids []int) (SpinResult, error)
func (*EndpointSet) SpinUnweighted ¶
func (e *EndpointSet) SpinUnweighted(ctx context.Context, participantids []int) (SpinResult, error)
type Service ¶
type Service interface { Spin(ctx context.Context, participantIds []int) (SpinResult, error) SpinUnweighted(ctx context.Context, particantIds []int) (SpinResult, error) GetLast(ctx context.Context) (SpinResult, error) }
type ServiceMiddleware ¶
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger) ServiceMiddleware
type SpinResult ¶
type SpinResult struct { ParticipantIds []int `json:"participantIds"` WinnerId int `json:"winnerId"` }
func (SpinResult) String ¶
func (t SpinResult) String() string
Click to show internal directories.
Click to hide internal directories.