Documentation ¶
Index ¶
- Constants
- func FindEngramHashes() (map[uint]bool, error)
- func GetItemNameFromHash(itemHash string) (string, error)
- func GetRandomJoke() (string, string, error)
- func InitDatabase() error
- func InitEnv(url string)
- func InsertUnknownValueIntoTable(value, tableName string)
- func LoadItemMetadata() (*sql.Rows, error)
- func SaveLoadout(loadoutJSON []byte, membershipID, name string) error
- func SelectLoadout(membershipID, name string) (string, error)
- func SelectLoadouts(membershipID string) ([]string, error)
- func UpdateLoadout(loadoutJSON []byte, membershipID, name string) error
- type LookupDB
Constants ¶
const ( // UnknownClassTable is the name of the table that will hold all the unknown class values provided by Alexa UnknownClassTable = "unknown_classes" // UnknownItemTable is the name of the table that will hold the unknown item name values passed by Alexa UnknownItemTable = "unknown_items" )
Variables ¶
This section is empty.
Functions ¶
func FindEngramHashes ¶ added in v0.3.0
FindEngramHashes is responsible for querying all of the item_hash values that represent engrams and returning them in a map for quick lookup later.
func GetItemNameFromHash ¶ added in v0.2.0
GetItemNameFromHash is in charge of querying the database and reading the item name value for the given item hash.
func GetRandomJoke ¶ added in v1.0.0
GetRandomJoke will return a setup, punchline, and possibly an error for a random Destiny related joke.
func InitDatabase ¶ added in v0.2.0
func InitDatabase() error
InitDatabase is in charge of preparing any Statements that will be commonly used as well as setting up the database connection pool.
func InitEnv ¶ added in v1.1.0
func InitEnv(url string)
InitEnv provides a package level initialization point for any work that is environment specific
func InsertUnknownValueIntoTable ¶ added in v0.2.0
func InsertUnknownValueIntoTable(value, tableName string)
InsertUnknownValueIntoTable is a helper method for inserting a value into the specified table. This is used when a value for a slot type is not usable. For example when a class name for a character is not a valid Destiny class name.
func LoadItemMetadata ¶ added in v0.3.0
LoadItemMetadata will load all rows from the database for all items loaded out of the manifest. Only the required columns will be loaded into memory that need to be used later for common operations.
func SaveLoadout ¶ added in v1.2.0
SaveLoadout is responsible for persisting the provided serialized loadout to the database.
func SelectLoadout ¶ added in v1.2.0
SelectLoadout is responsible for querying the database for a loadout with the provided membership ID and loadout name. The return value is the JSON string for the loadout requested.
func SelectLoadouts ¶ added in v1.8.1
SelectLoadouts is responsible for querying the database for a loadout with the provided membership ID and loadout name. The return value is the JSON string for the loadout requested.
func UpdateLoadout ¶ added in v1.2.0
UpdateLoadout can be used to update an existing loadout by membership ID and loadout name this should be used after confirming with the user that they want to update a loadout with a spepcific name.
Types ¶
type LookupDB ¶ added in v0.2.0
type LookupDB struct { Database *sql.DB HashFromNameStmt *sql.Stmt NameFromHashStmt *sql.Stmt EngramHashStmt *sql.Stmt ItemMetadataStmt *sql.Stmt RandomJokeStmt *sql.Stmt InsertLoadoutStmt *sql.Stmt UpdateLoadoutStmt *sql.Stmt SelectLoadoutStmt *sql.Stmt SelectLoadoutByNameStmt *sql.Stmt }
LookupDB is a wrapper around the database connection pool that stores the commonly used queries as prepared statements.
func GetDBConnection ¶
GetDBConnection is a helper for getting a connection to the DB based on environment variables or some other method.