Documentation ¶
Index ¶
- type Database
- type Filters
- type InMemory
- func (memory *InMemory) AddEvent(event *model.Event) error
- func (memory *InMemory) DeleteEvent(id primitive.ObjectID) error
- func (memory *InMemory) GetEvent(id primitive.ObjectID) (*model.Event, error)
- func (memory *InMemory) GetEvents(queryParams url.Values) (*model.Events, error)
- func (memory *InMemory) Shutdown(ctx context.Context)
- func (memory *InMemory) UpdateEvent(id primitive.ObjectID, event *model.Event) error
- type MongoDB
- func (mongo MongoDB) AddEvent(event *model.Event) error
- func (mongo MongoDB) DeleteEvent(id primitive.ObjectID) error
- func (mongo MongoDB) GetEvent(id primitive.ObjectID) (*model.Event, error)
- func (mongo MongoDB) GetEvents(queryParams url.Values) (*model.Events, error)
- func (mongo MongoDB) Shutdown(ctx context.Context)
- func (mongo MongoDB) UpdateEvent(id primitive.ObjectID, event *model.Event) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { Shutdown(context.Context) GetEvents(queryParams url.Values) (*model.Events, error) GetEvent(id primitive.ObjectID) (*model.Event, error) AddEvent(event *model.Event) error UpdateEvent(id primitive.ObjectID, event *model.Event) error DeleteEvent(id primitive.ObjectID) error }
Database is an interface representing data base service with all CRUD operations
type Filters ¶
type Filters struct {
// contains filtered or unexported fields
}
Filters is a struct containing all settings for filtering DB data
func NewFilters ¶
func NewFilters(config *utils.ConfigServer) *Filters
NewFilters is a factory method for creating Filters structure
func (Filters) GetAvailable ¶
GetAvailable returns list of available filter names
func (Filters) GetFilters ¶
GetFilters is used to update bson interface to filter MongoDB results
func (Filters) GetOptions ¶
GetOptions is used to specify find request MongoDB options
type InMemory ¶
type InMemory struct {
// contains filtered or unexported fields
}
InMemory is a test data base service with elements stored in RAM
func NewInMemory ¶
NewInMemory is a factory method to create an in memory data base service
func (*InMemory) DeleteEvent ¶
DeleteEvent deletes a event with specified ID from the database
type MongoDB ¶
type MongoDB struct {
// contains filtered or unexported fields
}
MongoDB is a data base service with elements are stored with use of MongoDB
func NewMongoDB ¶
func NewMongoDB(config *utils.ConfigMongo, filters *Filters) (*MongoDB, error)
NewMongoDB is a factory method to create a Mongo DB service
func (MongoDB) DeleteEvent ¶
DeleteEvent deletes a event with specified ID from the database