Documentation ¶
Index ¶
- type DB
- type OutdoorsightDB
- func (ods *OutdoorsightDB) AddSpot(ctx context.Context, details SpotDetails) (interface{}, error)
- func (ods *OutdoorsightDB) DeleteSpot(ctx context.Context, spotName string) (int64, error)
- func (ods *OutdoorsightDB) GetSpot(ctx context.Context, spotName string) (*spot.Details, error)
- func (ods *OutdoorsightDB) UpdateSpot(ctx context.Context, spotName string, sd SpotDetails) (int64, int64, error)
- type Route
- type SpotDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { // Manage spot AddSpot(ctx context.Context, details SpotDetails) (interface{}, error) GetSpot(ctx context.Context, spotName string) (*spot.Details, error) UpdateSpot(ctx context.Context, spotName string, update SpotDetails) (int64, int64, error) DeleteSpot(ctx context.Context, spotName string) (int64, error) }
DB is the database interface All the accesses to the database are hidden here
type OutdoorsightDB ¶
OutdoorsightDB is the structure holding the core DB
func (*OutdoorsightDB) AddSpot ¶
func (ods *OutdoorsightDB) AddSpot(ctx context.Context, details SpotDetails) (interface{}, error)
AddSpot inserts a spot with all its details in database
func (*OutdoorsightDB) DeleteSpot ¶
DeleteSpot deletes a spot from database
func (*OutdoorsightDB) UpdateSpot ¶
func (ods *OutdoorsightDB) UpdateSpot(ctx context.Context, spotName string, sd SpotDetails) (int64, int64, error)
UpdateSpot updates a spot in database
type Route ¶
type Route struct { Name string `bson:"name,omitempty"` Level string `bson:"level,omitempty"` Points int `bson:"points,omitempty"` Information string `bson:"information,omitempty"` }
Route holds the information about a route
type SpotDetails ¶
type SpotDetails struct { Name string `bson:"name,omitempty"` Routes []Route `bson:"routes,omitempty"` Metadata map[string]interface{} `bson:"metadata,omitempty"` }
SpotDetails is the database structure that holds the information about a spot We do not want to expose the database format to the world, so we redefine it.
Click to show internal directories.
Click to hide internal directories.