Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DataSourceErr = errors.New("data source is not working")
View Source
var UnexpectedTypeErr = errors.New("unable to get object as expected type")
Functions ¶
This section is empty.
Types ¶
type DataSource ¶
type DataSource interface { // Save a translation Save(word models.TranslationPair) error // List get back all the saved translations List() ([]models.TranslationPair, error) }
DataSource specify the operations for storing data
func NewInMemoryDataSource ¶
func NewInMemoryDataSource() DataSource
type InMemoryDataSource ¶
func (*InMemoryDataSource) List ¶
func (ds *InMemoryDataSource) List() ([]models.TranslationPair, error)
func (*InMemoryDataSource) Save ¶
func (ds *InMemoryDataSource) Save(word models.TranslationPair) error
Click to show internal directories.
Click to hide internal directories.