Documentation ¶
Overview ¶
Package query contains the functions that access the database directly. This reference implementation has a set of specific and general purpose queries directed at a Mongodb Database. Specific Queries are application specific and are directed at specified collections documents and fields. The function, QueryDB is a general purpose method that accepts the parameters required to execute a MongoDB find operation on any collection and document.
Index ¶
- func Ejection(uri string, database string, filter interface{}, projection interface{}) ([]jsontypes.Ejection, error)
- func Exec(qp ExecParams, q Decoder) error
- func Games(uri string, database string, filter interface{}, projection interface{}) ([]jsontypes.Game, error)
- func GetFavorites(uri string, coll string) ([]string, error)
- func GetMongodbURI() string
- func InsertFavorite(uri string, collection string, id string, uid string) (string, error)
- func InsertFavoritePerson(uri string, uid string) (string, error)
- func Parks(uri string, database string, filter interface{}, projection interface{}) ([]jsontypes.Park, error)
- func Personnel(uri string, database string, filter interface{}, projection interface{}) ([]jsontypes.Person, error)
- func PlayerTeams(uri string, database string, filter interface{}, projection interface{}) ([]jsontypes.PlayerTeams, error)
- func RemoveFavorite(uri string, collection string, id string, uid string) (string, error)
- func RemoveFavoritePerson(uri string, uid string) (string, error)
- func Teams(uri string, database string, filter interface{}, projection interface{}) ([]jsontypes.Team, error)
- type Decoder
- type EjectionQuery
- type ExecParams
- type Fave
- type FavoritesQuery
- type GameQuery
- type ParkQuery
- type PersonQuery
- type PlayerTeamsQuery
- type TeamQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ejection ¶
func Ejection(uri string, database string, filter interface{}, projection interface{}) ([]jsontypes.Ejection, error)
Ejection ...
func Exec ¶
func Exec(qp ExecParams, q Decoder) error
Exec : general purpose query function to access the database
func Games ¶
func Games(uri string, database string, filter interface{}, projection interface{}) ([]jsontypes.Game, error)
Games : uses general purpose QueryDB to access the database
func GetFavorites ¶
GetFavorites returns the list of UIDs for a specified collection
func GetMongodbURI ¶
func GetMongodbURI() string
GetMongodbURI : returns the connection string for mongodb from the environment
func InsertFavorite ¶
InsertFavorite : insert the UID of a record into the specified collection it returns the UID that is stored, or an error indicating what went wrong
func InsertFavoritePerson ¶
InsertFavoritePerson : add the persons UID to the list of favorites
func Parks ¶
func Parks(uri string, database string, filter interface{}, projection interface{}) ([]jsontypes.Park, error)
Parks performs the same query as GetTeamByKey above, however it uses the 'queryDB' function that handles the database connection and access. The only things this function needs to provide are the database parameters and an object that implements the query_util:Query interface
func Personnel ¶
func Personnel(uri string, database string, filter interface{}, projection interface{}) ([]jsontypes.Person, error)
Personnel performs the same query as GetPersonByKey above, however it uses the 'queryDB' function that handles the database connection and access. The only things this function needs to provide are the database parameters and an object that implements the query_util:Query interface
func PlayerTeams ¶
func PlayerTeams(uri string, database string, filter interface{}, projection interface{}, ) ([]jsontypes.PlayerTeams, error)
PlayerTeams ...
func RemoveFavorite ¶
RemoveFavorite removes one UID from the list of favorites in the database it works for any of the three favorite collections
func RemoveFavoritePerson ¶
RemoveFavoritePerson : removes the person's UID from the list of favorites
func Teams ¶
func Teams(uri string, database string, filter interface{}, projection interface{}) ([]jsontypes.Team, error)
Teams performs the same query as GetTeamByKey above, however it uses the 'queryDB' function that handles the database connection and access. The only things this function needs to provide are the database parameters and an object that implements the query_util:Query interface
Types ¶
type Decoder ¶
type Decoder interface {
// contains filtered or unexported methods
}
Decoder : interface required by Exec to decode the JSON output from the database into Go types
type EjectionQuery ¶
type EjectionQuery struct {
// contains filtered or unexported fields
}
EjectionQuery : a struct that gets the results of a query
type ExecParams ¶
type ExecParams struct {
// contains filtered or unexported fields
}
ExecParams : specifies the parameteers require for the Exec function
type FavoritesQuery ¶
type FavoritesQuery struct {
// contains filtered or unexported fields
}
FavoritesQuery : holds the favorites for a given collection
type GameQuery ¶
type GameQuery struct {
// contains filtered or unexported fields
}
GameQuery : a struct that gets the results of a query
type ParkQuery ¶
type ParkQuery struct {
// contains filtered or unexported fields
}
ParkQuery : a struct that gets the results of a query
type PersonQuery ¶
type PersonQuery struct {
// contains filtered or unexported fields
}
PersonQuery : a struct that gets the results of a query
type PlayerTeamsQuery ¶
type PlayerTeamsQuery struct {
// contains filtered or unexported fields
}
PlayerTeamsQuery : a struct that gets the results of a query