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.
Click to show internal directories.
Click to hide internal directories.