Documentation ¶
Overview ¶
package store implements a database store for goresource.
Index ¶
- type MongoStore
- func (s *MongoStore) Close()
- func (s *MongoStore) CreateEntity(name string, data interface{}, result interface{}) error
- func (s *MongoStore) DeleteEntity(name string, id string) error
- func (s *MongoStore) GetEntity(name string, id string, result interface{}) error
- func (s *MongoStore) ListEntities(name string, filters url.Values, result interface{}) error
- func (s *MongoStore) UpdateEntity(name string, id string, data interface{}, result interface{}) error
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoStore ¶
type MongoStore struct {
// contains filtered or unexported fields
}
MongoStore is a store implementation using mongodb as the database.
func (*MongoStore) Close ¶
func (s *MongoStore) Close()
Close tears down the database connection and closes the session.
func (*MongoStore) CreateEntity ¶
func (s *MongoStore) CreateEntity(name string, data interface{}, result interface{}) error
CreateEntity persists a new entity with the given data.
func (*MongoStore) DeleteEntity ¶
func (s *MongoStore) DeleteEntity(name string, id string) error
DeleteEntity removes a specific entity with the given id.
func (*MongoStore) GetEntity ¶
func (s *MongoStore) GetEntity(name string, id string, result interface{}) error
ListEntities fetches a specific entity with the given id.
func (*MongoStore) ListEntities ¶
func (s *MongoStore) ListEntities(name string, filters url.Values, result interface{}) error
ListEntities queries and returns all entities matching the given filters.
func (*MongoStore) UpdateEntity ¶
func (s *MongoStore) UpdateEntity(name string, id string, data interface{}, result interface{}) error
UpdateEntity updates a specific entity corresponding the given id, with the given data.
type Store ¶
type Store interface { GetEntity(name string, id string, result interface{}) error CreateEntity(name string, data interface{}, result interface{}) error ListEntities(name string, filters url.Values, result interface{}) error UpdateEntity(name string, id string, data interface{}, result interface{}) error DeleteEntity(name string, id string) error Close() }
Store iterface is implemented by database stores.
Click to show internal directories.
Click to hide internal directories.