api

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: 9 Imported by: 0

Documentation

Overview

Package api provides the mapping of the JSON documents to GraphQL. It includes the schema and resolvers for Teams, Games Personnel and Favorites. It contains functions that map the resolvers to the query package (db.go). It includes an HTTP server implementation that exposes the GraphQL API to clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBGetEjections

func DBGetEjections(uri string, teamAbbr string, ejectedName string, date string) ([]jt.Ejection, error)

DBGetEjections : returns a list of ejections by a combination of team, name and date

func DBGetEjectionsByDate

func DBGetEjectionsByDate(uri string, date string) ([]jt.Ejection, error)

DBGetEjectionsByDate ...

func DBGetEjectionsByEjectedID

func DBGetEjectionsByEjectedID(uri string, ejectedid string) ([]jt.Ejection, error)

DBGetEjectionsByEjectedID ...

func DBGetEjectionsByTeamAbbr

func DBGetEjectionsByTeamAbbr(uri string, teamabbr string) ([]jt.Ejection, error)

DBGetEjectionsByTeamAbbr ...

func DBGetFavorites

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

DBGetFavorites : returns a list of favorites from the specified favorites collection : see the collection names above

func DBGetGames

func DBGetGames(uri string, filter interface{}, projection interface{}) ([]jt.Game, error)

DBGetGames : returns a list of games by an arbitrary filter and projection

func DBGetGamesByDate

func DBGetGamesByDate(uri string, date string) ([]jt.Game, error)

DBGetGamesByDate : returns a list of games by the date

func DBGetGamesByDateRange

func DBGetGamesByDateRange(uri string, start string, end string) ([]jt.Game, error)

func DBGetGamesByPlayer

func DBGetGamesByPlayer(uri string, playerID string) ([]jt.Game, error)

DBGetGamesByPlayer : returns a list of games a player played in, either home or visitor

func DBGetGamesByTeam

func DBGetGamesByTeam(uri string, team string) ([]jt.Game, error)

DBGetGamesByTeam : returns a list of games a team played in, either home or visitor this will be a long list

func DBGetGamesByTeamAndDate

func DBGetGamesByTeamAndDate(uri string, team string, date string) ([]jt.Game, error)

DBGetGamesByTeamAndDate : returns a list of games a team played in, either home or visitor and by the date

func DBGetGamesByUID

func DBGetGamesByUID(uri string, uid string) ([]jt.Game, error)

DBGetGamesByUID : returns a list of games by the (unique) UID

func DBGetParksAll

func DBGetParksAll(uri string) ([]jt.Park, error)

DBGetParksAll : returns all parks

func DBGetPersonsByFullName

func DBGetPersonsByFullName(uri string, first string, last string) ([]jt.Person, error)

DBGetPersonsByFullName : returns a list of persons by both the first and last name

func DBGetPersonsByID

func DBGetPersonsByID(uri string, id string) ([]jt.Person, error)

DBGetPersonsByID : returns persons by the ID field in the record not the _id field, but the ID field from the original data

func DBGetPersonsByLastName

func DBGetPersonsByLastName(uri string, last string) ([]jt.Person, error)

DBGetPersonsByLastName : returns a list of persons by the last name

func DBGetPersonsByUID

func DBGetPersonsByUID(uri string, uid string) ([]jt.Person, error)

DBGetPersonsByUID : returns list of persons by the UID. The UID should be unique but to keep parallel to other functions it returns a slicee

func DBGetPlayerTeams

func DBGetPlayerTeams(uri string, playerID string) ([]jt.PlayerTeams, error)

DBGetPlayerTeams ...

func DBGetTeamsAll

func DBGetTeamsAll(uri string) ([]jt.Team, error)

DBGetTeamsAll : returns all teams

func DBGetTeamsByAbbr

func DBGetTeamsByAbbr(uri string, abbr string) ([]jt.Team, error)

DBGetTeamsByAbbr : returns a list of teams by the 'abbr' field which is unique to each team

func DBGetTeamsByNickname

func DBGetTeamsByNickname(uri string, nickname string) ([]jt.Team, error)

DBGetTeamsByNickname : returns a list of teams by the team 'nickname'

func DBGetTeamsByUID

func DBGetTeamsByUID(uri string, uid string) ([]jt.Team, error)

DBGetTeamsByUID : returns a team by the specified UID. There should only be one but to be parallel to the other functions it returns an array

func DBInsertFavoriteGame

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

DBInsertFavoriteGame : inserts a game into the favorites collection

func DBInsertFavoritePerson

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

DBInsertFavoritePerson : adds a persons UID to the list of favorite persons

func DBInsertFavoriteTeam

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

DBInsertFavoriteTeam : adds a teams UID to the list of favorite teams

func DBRemoveFavoriteGame

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

DBRemoveFavoriteGame : removes a game from the favorites collection

func DBRemoveFavoritePerson

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

DBRemoveFavoritePerson : removes a persons UID from the list of favorite persons

func DBRemoveFavoriteTeam

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

DBRemoveFavoriteTeam : removes a teams UID from the list of favorite teams

func RootSchema

func RootSchema() *graphql.Schema

RootSchema return the parsed schema

func Run

func Run(url string, mongodb string)

Run : start the GraphQL server

Types

type EjectedArgs

type EjectedArgs struct {
	EjectedID string
}

EjectedArgs ...

type PlayerArgs

type PlayerArgs struct {
	PlayerID string
}

PlayerArgs ...

type PlayerTeams

type PlayerTeams struct {
	PlayerID string
	Teams    *[]string
	UID      string
}

PlayerTeams : for conversion of Teams to *[]string

Jump to

Keyboard shortcuts

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