query

package
v0.0.0-...-d2b6d94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2021 License: MIT Imports: 8 Imported by: 0

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

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

func GetFavorites(
	uri string,
	coll string,
) ([]string, error)

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

func InsertFavorite(
	uri string,
	collection string,
	id string,
	uid string,
) (string, error)

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

func InsertFavoritePerson(uri string, uid string) (string, error)

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

func RemoveFavorite(
	uri string,
	collection string,
	id string,
	uid string,
) (string, error)

RemoveFavorite removes one UID from the list of favorites in the database it works for any of the three favorite collections

func RemoveFavoritePerson

func RemoveFavoritePerson(uri string, uid string) (string, error)

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 Fave

type Fave struct {
	ID  string   `bson:"_id"`
	UID []string `bson:"uid"`
}

Fave : has the BSON type def for the favorite collection

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

type TeamQuery

type TeamQuery struct {
	// contains filtered or unexported fields
}

TeamQuery : a struct that gets the results of a query

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL