domain

package
v0.0.0-...-6fb8f96 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GeneralError is the common error response when something on the server went wrong (HTTP code 500).
	GeneralError = "Ups, Something went wrong !"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	ID   bson.ObjectId `json:"id" bson:"_id"`
	Time int64         `json:"time" bson:"time"`
}

Entry is the main class to encapsulate a single win or fail.

func NewEntry

func NewEntry() *Entry

NewEntry creates a new Entry with the current time.

type MyWinsAPI

type MyWinsAPI struct {
	// contains filtered or unexported fields
}

MyWinsAPI is the class that implements all MyWins endpoints.

func NewAPI

func NewAPI(client PersistenceAPIClient) *MyWinsAPI

NewAPI instantiates MyWins API.

func (*MyWinsAPI) AddFail

func (api *MyWinsAPI) AddFail() error

AddFail submits a fail for the current day.

func (*MyWinsAPI) AddWin

func (api *MyWinsAPI) AddWin() error

AddWin submits a win for the current day.

func (*MyWinsAPI) FindAllFails

func (api *MyWinsAPI) FindAllFails() ([]*Entry, error)

FindAllFails retrieves all fails.

func (*MyWinsAPI) FindAllWins

func (api *MyWinsAPI) FindAllWins() ([]*Entry, error)

FindAllWins retrieves all wins.

type PersistenceAPIClient

type PersistenceAPIClient interface {
	GetWins() ([]*Entry, error)
	GetFails() ([]*Entry, error)
	AddWin() error
	AddFail() error
}

PersistenceAPIClient if the interface definition to any persistence system that want to adapt MyWins API.

Jump to

Keyboard shortcuts

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