number

package
v0.0.0-...-afaedbc Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeInsertRequest

func DecodeInsertRequest(_ context.Context, r *http.Request) (interface{}, error)

func NewInsertEndpoint

func NewInsertEndpoint(svc NumberService) endpoint.Endpoint

func NewInsertHandler

func NewInsertHandler(ctx context.Context, svc NumberService) http.Handler

func NewTotalEndpoint

func NewTotalEndpoint(svc NumberService) endpoint.Endpoint

func NewTotalHandler

func NewTotalHandler(ctx context.Context, svc NumberService) http.Handler

Types

type InsertRequest

type InsertRequest struct {
	User string `json:"user"`
	// TODO: type alias
	Number int `json:"number"`
}

type InsertResponse

type InsertResponse struct {
	Message string `json:"message"`
	common.ErrResponse
}

type NumberRepository

type NumberRepository interface {
	Store(s *Submission) error
	Find(u User) (*Submission, error)
	FindAll() []*Submission
}

func NewNumberRepository

func NewNumberRepository() NumberRepository

type NumberService

type NumberService interface {
	Insert(string, int) (string, error)
	Total() int
}

NumberService represents the feature: Inserting Number

func NewNumberService

func NewNumberService(r NumberRepository) NumberService

type TotalResponse

type TotalResponse struct {
	Total int `json:"total"`
	common.ErrResponse
}

Jump to

Keyboard shortcuts

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