models

package
v0.0.0-...-f47669d Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dog

type Dog struct {
	ID   bson.ObjectId `json:"id" bson:"_id,omitempty"`
	Name string        `json:"name"`
	Age  int32         `json:"age"`
	Type string        `json:"type"`
}

Dog data struct

type DogMongoStore

type DogMongoStore struct {
	DogsDataStore
	DBName         string
	CollectionName string
	Session        *mgo.Session
}

DogMongoStore implements DogsDataStore

func NewDogMongoStore

func NewDogMongoStore(mongoDBURL, DBName, CollectionName string) (*DogMongoStore, error)

func (*DogMongoStore) CreateDog

func (dataStore *DogMongoStore) CreateDog(dog *Dog) (err error)

func (*DogMongoStore) DeleteDog

func (dataStore *DogMongoStore) DeleteDog(id string) (err error)

func (*DogMongoStore) Disconnect

func (dataStore *DogMongoStore) Disconnect()

func (*DogMongoStore) ReadAllDogs

func (dataStore *DogMongoStore) ReadAllDogs() (dogs []*Dog, err error)

func (*DogMongoStore) ReadDog

func (dataStore *DogMongoStore) ReadDog(id string) (dog *Dog, err error)

func (*DogMongoStore) UpdateDog

func (dataStore *DogMongoStore) UpdateDog(dog *Dog) (err error)

type DogsDataStore

type DogsDataStore interface {
	ReadAllDogs() (dogs []*Dog, err error)
	CreateDog(dog *Dog) (err error)
	ReadDog(id string) (dog *Dog, err error)
	UpdateDog(dog *Dog) (err error)
	DeleteDog(id string) (err error)
}

DogsDataStore represents interface to manage dogs

Jump to

Keyboard shortcuts

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