service

package
v0.0.0-...-8549517 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoRepository

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

MongoRepository implements a RepositoryService with a Mongo DB backing store.

func NewMongoRepository

func NewMongoRepository(url string, dbName string) (MongoRepository, error)

NewMongoRepository constructs a new instance of MongoRepository

func (MongoRepository) Find

func (m MongoRepository) Find(resource string, id string) (interface{}, error)

Find retrieves the document with the given id.

func (MongoRepository) Insert

func (m MongoRepository) Insert(resource string, data interface{}) error

Insert inserts a new document in the database for the given resource collection.

type RepositoryService

type RepositoryService interface {
	Insert(resource string, data interface{}) error
	// Update(resource string, data interface{}) error
	// Delete(resource string, id string) error
	Find(resource string, id string) (interface{}, error)
}

RepositoryService declares an interface for data persistence operations.

Jump to

Keyboard shortcuts

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