Categorygithub.com/vikebot/vbdb
modulepackage
0.1.5
Repository: https://github.com/vikebot/vbdb.git
Documentation: pkg.go.dev

# README

vbdb

Package to provide easy access to vikebot databases from go source code.

Build Status codecov Go Report Card GoDoc

Dependency diagram

Dependency diagram

# Functions

ActiveRoundentries is the same as `ActiveRoundentriesCtx` but uses the `defaultCtx` as logger.
ActiveRoundentriesCtx returns all Roundentries from a user, for games which are currently of status `vbcore.RoundStatusOpen`, `vbcore.RoundStatusClosed` or `vbcore.RoundStatusRunning`.
ActiveRounds is the same as `ActiveRoundsCtx` but uses the `defaultCtx` as logger.
ActiveRoundsCtx loads all rounds which have not status `vbcore.RoundStatusFinished`.
CountGames is the same as `CountGamesCtx` but uses the `defaultCtx` as logger.
CountGamesCtx adds up all existing roundentries.
CountUsers is the same as `CountUsersCtx` but uses the `defaultCtx` as logger.
CountUsersCtx adds up the amount of all registered users.
ExistsMessage checks wheter the id (and therefore) it's associated value exist or not.
Init initializes all internally used structures of vbdb.
InsertMessage inserts the passed string into the msg table and returns the auto-incremented id (foreign-key in other tables).
JoinedUsers is the same as `JoinedUsersCtx` but uses the `defaultCtx` as logger.
JoinedUsersCtx returns the `userID`s of all users which joined the round specified through the roundID.
JoinRound is the same as `JoinRoundCtx` but uses the `defaultCtx` as logger.
JoinRoundCtx lets the user join the specified round.
JwtAdd is the same as `JwtAddCtx` but uses the `defaultCtx` as logger.
JwtAddCtx adds the passed `jti` (JWT ID), `exp` and `userID` into the `jwts` table as valid entries.
JwtIsBlacklisted is the same as `JwtIsBlacklistedCtx` but uses the `defaultCtx` as logger.
JwtIsBlacklistedCtx checks whether the passed `jti` (JWT ID) is already blacklisted or not.
OAuthExists is the same as `OAuthExistsCtx` but uses the `defaultCtx` as logger.
OAuthExistsCtx checks if the `providerID` is already registered with the specified `provider`.
RegcodeFromUserID is the same as `RegcodeFromUserIDCtx` but uses the `defaultCtx` as logger.
RegcodeFromUserIDCtx exchanged a `userID` to it's associated registration code and a `finished` state (indicating the state of the registration).
RegisterOauthGithub is the same as `RegisterOauthGithubCtx` but uses the `defaultCtx` as logger.
RegisterOauthGithubCtx maps the `*github.User` instance to a `vbcore.User` and passes it to `RegisterUserCtx`.
RegisterOauthGoogle is the same as `RegisterOauthGoogleCtx` but uses the `defaultCtx` as logger.
RegisterOauthGoogleCtx maps the `*vbcore.GoogleUser` instance to a `vbcore.User` and passes it to `RegisterUserCtx`.
RegisterUser is the same as `RegisterUserCtx` but uses the `defaultCtx` as logger.
RegisterUserCtx registers a new user and returns the user's ID, the msgID used for all inserts and a registration code (which the user must use in order to register later).
RoundentryConnectinfo is the same as `RoundentryConnectinfoCtx` but uses the `defaultCtx` as logger.
RoundentryConnectinfoCtx returns everything needed to connect to the `vbgs` instance hosting the game associated with the `authtoken`.
RoundentryFromRoundticket is the same as `RoundentryFromRoundticketCtx` but uses the `defaultCtx` as logger.
RoundentryFromRoundticketCtx verifies that a user passed `roundticket` exists in the database.
RoundentryFromWatchtoken is the same as `RoundentryFromWatchtokenCtx` but uses the `defaultCtx` as logger.
RoundentryFromWatchtokenCtx verifies that a user passed `watchtoken` exists in the database.
RoundExists is the same as `RoundExistsCtx` but uses the `defaultCtx` as logger.
RoundExistsCtx checks whether a round specified by it's ID exists or not.
SelectMessage receives the message associated to the passed id.
SelectMessageExists checks whether the id (and therefore) it's associated value exists or not and if so also returns the value.
UpdateUser is the same as `UpdateUserCtx` but uses the `defaultCtx` as logger.
UpdateUserCtx compares a newUser with an oldUser and updates the differences into the database.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
UserFromID is the same as `UserFromIDCtx` but uses the `defaultCtx` as logger.
UserFromIDCtx loads the user associated with the given `userID`.
UserFromUsername is the same as `UserFromUsernameCtx` but uses the `defaultCtx` as logger.
UserFromUsernameCtx loads the user associated with the given `username`.
UserIDFromRegcode is the same as `UserIDFromRegcodeCtx` but uses the `defaultCtx` as logger.
UserIDFromRegcodeCtx exchanges a registration code for a `userID` and a `finished` state (indicating the state of the registration).
UserIDFromUsername is the same as `UserIDFromUsernameCtx` but uses the `defaultCtx` as logger.
UserIDFromUsernameCtx tries to find the user which currently uses th passed username.
UsernameFromID returns a username as string from an given ID.
UsernameFromIDCtx loads the username associated with the given `userID`.
UsernamesFromRoundID returns usernames as a slice of string from an given roundID.
UsernamesFromRoundIDCtx loads the usernames associated with the given `roundID`.
UserPermission is the same as `UserPermissionCtx` but uses the `defaultCtx` as logger.
UserPermissionCtx loads the current permission of the specified user from the database.
No description provided by the author
WebsocketAddressFromWatchtokenCtx resolves a watchtoken to it's associated gameserver's websocket address.

# Structs

Config collects all relevant informations/credentials to access a vikebot database.