data

package
v0.0.0-...-b149654 Latest Latest
Warning

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

Go to latest
Published: May 7, 2017 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kitten

type Kitten struct {
	Id     string
	Name   string
	Weight float32
}

type MemoryStore

type MemoryStore struct {
}

MemoryStore is a simple in memory datastore that implements Store

func (*MemoryStore) Search

func (m *MemoryStore) Search(name string) []Kitten

Search returns a slice of Kitten which have a name matching the name in the parameters

type MockStore

type MockStore struct {
	mock.Mock
}

MockStore is a mock implementation of a datastore for testing purposes

func (*MockStore) Search

func (m *MockStore) Search(name string) []Kitten

Search returns the object which was passed to the mock on setup

type MongoStore

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

MongoStore is a MongoDB data store which implements the Store interface

func NewMongoStore

func NewMongoStore(connection string) (*MongoStore, error)

NewMongoStore creates an instance of MongoStore with the given connection string

func (*MongoStore) DeleteAllKittens

func (m *MongoStore) DeleteAllKittens()

DeleteAllKittens deletes all the kittens from the datastore

func (*MongoStore) InsertKittens

func (m *MongoStore) InsertKittens(kittens []Kitten)

InsertKittens inserts a slice of kittens into the datastore

func (*MongoStore) Search

func (m *MongoStore) Search(name string) []Kitten

Search returns Kittens from the MongoDB instance which have the name name

type Store

type Store interface {
	Search(name string) []Kitten
}

Store is an interface used for interacting with the backend datastore

Jump to

Keyboard shortcuts

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