Documentation
¶
Index ¶
- func MakeMultiInsertStatement(table string, columns []string, numInserts int, returningCol string) string
- type Character
- type CharacterCreate
- type CharacterManager
- type CharacterUpdate
- type DB
- func (db *DB) CreateCharacter(characterCreate *CharacterCreate) (*Character, error)
- func (db *DB) CreateMatch(matchCreate *MatchCreate) (int64, error)
- func (db *DB) CreateMatchTags(matchTagsCreate []*MatchTagCreate) ([]int64, error)
- func (db *DB) CreateTag(tagCreate *TagCreate) (int, error)
- func (db *DB) CreateUser(userCreate *UserCreate) (int64, error)
- func (db *DB) CreateUserCharacter(userCharacterCreate *UserCharacterCreate) (int64, error)
- func (db *DB) DeleteMatchByMatchID(matchID int64) (int64, error)
- func (db *DB) DeleteMatchTagsByMatchID(matchID int64) ([]int64, error)
- func (db *DB) DeleteTagByTagID(tagID int64) (int64, error)
- func (db *DB) DeleteUserCharacterByID(userCharacterID int64) (int64, error)
- func (db *DB) GetAllCharacters() ([]*Character, error)
- func (db *DB) GetAllMatchTagViews() ([]*MatchTagView, error)
- func (db *DB) GetAllMatchViews() ([]*MatchView, error)
- func (db *DB) GetAllTags() ([]*Tag, error)
- func (db *DB) GetAllUsers() ([]*User, error)
- func (db *DB) GetMatchTagViewsByMatchID(matchID int64) ([]*MatchTagView, error)
- func (db *DB) GetMatchViewByMatchID(matchID int64) (*MatchView, error)
- func (db *DB) GetTagByTagID(tagID int) (*Tag, error)
- func (db *DB) GetUserCharacterViewByUserCharacterID(userCharID int64) (*UserCharacterView, error)
- func (db *DB) GetUserCharacterViewsByUserID(userID int64) ([]*UserCharacterView, error)
- func (db *DB) GetUserCharactersByUserID(userID int64) ([]*UserCharacter, error)
- func (db *DB) GetUserCredentialsViewByEmail(email string) (*UserCredentialsView, error)
- func (db *DB) GetUserIDByEmail(email string) (int64, error)
- func (db *DB) GetUserProfileViewByUserID(userID int64) (*UserProfileView, error)
- func (db *DB) GetUserResetPasswordTokenByUserID(userID int64) (string, error)
- func (db *DB) GetUserRoleViewsByUserID(userID int64) ([]*UserRoleView, error)
- func (db *DB) UpdateCharacter(characterUpdate *CharacterUpdate) (*Character, error)
- func (db *DB) UpdateMatch(matchUpdate *MatchUpdate) (int64, error)
- func (db *DB) UpdateTag(tagUpdate *TagUpdate) (int, error)
- func (db *DB) UpdateUserCharacter(userCharacterUpdate *UserCharacterUpdate) (int64, error)
- func (db *DB) UpdateUserDefaultUserCharacter(userCharUpdate *UserDefaultUserCharacterUpdate) (int64, error)
- func (db *DB) UpdateUserHashedPassword(hashedPasswordUpdate *UserHashedPasswordUpdate) (int64, error)
- func (db *DB) UpdateUserProfile(profileUpdate *UserProfileUpdate) (int64, error)
- func (db *DB) UpdateUserRefreshToken(refreshUpdate *UserRefreshUpdate) (int64, error)
- func (db *DB) UpdateUserResetPasswordToken(resetPasswordUpdate *UserResetPasswordUpdate) (int64, error)
- type DatabaseManager
- type Match
- type MatchCreate
- type MatchDelete
- type MatchManager
- type MatchTag
- type MatchTagCreate
- type MatchTagManager
- type MatchTagView
- type MatchTagViewManager
- type MatchUpdate
- type MatchView
- type MatchViewManager
- type NullBoolJSON
- type NullInt64JSON
- type NullStringJSON
- type NullTimeJSON
- type Tag
- type TagCreate
- type TagDelete
- type TagManager
- type TagUpdate
- type User
- type UserCharacter
- type UserCharacterCreate
- type UserCharacterDelete
- type UserCharacterManager
- type UserCharacterUpdate
- type UserCharacterView
- type UserCharacterViewManager
- type UserCreate
- type UserCredentialsView
- type UserDefaultUserCharacterUpdate
- type UserHashedPasswordUpdate
- type UserManager
- type UserProfileUpdate
- type UserProfileView
- type UserRefreshUpdate
- type UserResetPasswordUpdate
- type UserRoleView
- type UserRoleViewManager
- type UserViewManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeMultiInsertStatement ¶
func MakeMultiInsertStatement(table string, columns []string, numInserts int, returningCol string) string
MakeMultiInsertStatement generates a PostgreSQL insert statement for a given table, set of columns, and the corresponding values; use to easily make a statement for inserting multiple rows into a the given table
Types ¶
type Character ¶
type Character struct {
CharacterID int64 `json:"characterId"`
CharacterName string `json:"characterName"`
CharacterStockImg NullStringJSON `json:"characterStockImg,omitempty"`
CharacterImg NullStringJSON `json:"characterImg,omitempty"`
CharacterArchetype NullStringJSON `json:"characterArchetype,omitempty"`
}
Character describes the required and optional data needed to create a new character in our characters table
type CharacterCreate ¶
type CharacterCreate struct {
CharacterName string `json:"characterName"`
CharacterStockImg NullStringJSON `json:"characterStockImg"`
CharacterImg NullStringJSON `json:"characterImg"`
CharacterArchetype NullStringJSON `json:"characterArchetype"`
}
CharacterCreate describes the data needed to create a given character in our db
type CharacterManager ¶
type CharacterManager interface {
GetAllCharacters() ([]*Character, error)
CreateCharacter(characterCreate *CharacterCreate) (*Character, error)
UpdateCharacter(characterUpdate *CharacterUpdate) (*Character, error)
}
CharacterManager describes all of the methods used to interact with the characters table in our database
type CharacterUpdate ¶
type CharacterUpdate struct {
CharacterID int64 `json:"characterId"`
CharacterName NullStringJSON `json:"characterName,omitempty"`
CharacterStockImg NullStringJSON `json:"characterStockImg,omitempty"`
CharacterImg NullStringJSON `json:"characterImg,omitempty"`
CharacterArchetype NullStringJSON `json:"characterArchetype,omitempty"`
}
CharacterUpdate describes the data needed to update a given character in our db
type DB ¶
DB is the struct that we're going to use to implement all of our Datasbase interfaces; All of the methods defined on each of our interfaces will be implemented on this DB struct
func New ¶
New initializes a new postgres database connection and attaches said connection to our DB struct, which we can then call all of the methods described by the our varies Database interfaces
func (*DB) CreateCharacter ¶
func (db *DB) CreateCharacter(characterCreate *CharacterCreate) (*Character, error)
CreateCharacter adds a new entry to the characters table in our database
func (*DB) CreateMatch ¶
func (db *DB) CreateMatch(matchCreate *MatchCreate) (int64, error)
CreateMatch adds a new entry to the matches table in our database
func (*DB) CreateMatchTags ¶
func (db *DB) CreateMatchTags(matchTagsCreate []*MatchTagCreate) ([]int64, error)
CreateMatchTags creates adds multiple "match tag" relationships
func (*DB) CreateUser ¶
func (db *DB) CreateUser(userCreate *UserCreate) (int64, error)
CreateUser adds a new entry to the users table in our database
func (*DB) CreateUserCharacter ¶
func (db *DB) CreateUserCharacter(userCharacterCreate *UserCharacterCreate) (int64, error)
CreateUserCharacter adds a new entry to the user_characters table
func (*DB) DeleteMatchByMatchID ¶
DeleteMatchByMatchID removes an existing entry in the matches table
func (*DB) DeleteMatchTagsByMatchID ¶
DeleteMatchTagsByMatchID deletes a set of existing "match tag" relationships for a given matchID
func (*DB) DeleteTagByTagID ¶
DeleteTagByTagID deletes an existing entry in the tags table
func (*DB) DeleteUserCharacterByID ¶
DeleteUserCharacterByID removes an existing entry in the user_characters table
func (*DB) GetAllCharacters ¶
GetAllCharacters gets all of the characters we have in our database
func (*DB) GetAllMatchTagViews ¶
func (db *DB) GetAllMatchTagViews() ([]*MatchTagView, error)
GetAllMatchTagViews gets all of the match tags
func (*DB) GetAllMatchViews ¶
GetAllMatchViews gets all of the data needed to display all recorded matches, which includes joined data from the matches, users, and characters tables
func (*DB) GetAllTags ¶
GetAllTags gets all of the tags we have in our database
func (*DB) GetAllUsers ¶
GetAllUsers fetches userId/userName for all users
func (*DB) GetMatchTagViewsByMatchID ¶
func (db *DB) GetMatchTagViewsByMatchID(matchID int64) ([]*MatchTagView, error)
GetMatchTagViewsByMatchID gets all of the match tags for a given matchID
func (*DB) GetMatchViewByMatchID ¶
GetMatchViewByMatchID gets all of the data needed to display an individual match, which includes joined data from the users and characters table
func (*DB) GetTagByTagID ¶
GetTagByTagID gets a specific tag given a tagID
func (*DB) GetUserCharacterViewByUserCharacterID ¶
func (db *DB) GetUserCharacterViewByUserCharacterID(userCharID int64) (*UserCharacterView, error)
GetUserCharacterViewByUserCharacterID gets all of the data needed to display a given "saved character", whicn includes joined data fromt the user_characters and characters table
func (*DB) GetUserCharacterViewsByUserID ¶
func (db *DB) GetUserCharacterViewsByUserID(userID int64) ([]*UserCharacterView, error)
GetUserCharacterViewsByUserID gets all of the data needed to display a given user's "saved characters", whicn includes joined data fromt the user_characters and characters table
func (*DB) GetUserCharactersByUserID ¶
func (db *DB) GetUserCharactersByUserID(userID int64) ([]*UserCharacter, error)
GetUserCharactersByUserID gets all of the "saved characters" for a given userID
func (*DB) GetUserCredentialsViewByEmail ¶
func (db *DB) GetUserCredentialsViewByEmail(email string) (*UserCredentialsView, error)
GetUserCredentialsViewByEmail gets a user's auth related information by their email; used for user authentication
func (*DB) GetUserIDByEmail ¶
GetUserIDByEmail gets a specific user's id from the users table by email
func (*DB) GetUserProfileViewByUserID ¶
func (db *DB) GetUserProfileViewByUserID(userID int64) (*UserProfileView, error)
GetUserProfileViewByUserID gets all of the data needed to display a user's profile, which includes joined data from the characters table
func (*DB) GetUserResetPasswordTokenByUserID ¶
GetUserResetPasswordTokenByUserID gets a user's reset_password_token; used for "forgot password"
func (*DB) GetUserRoleViewsByUserID ¶
func (db *DB) GetUserRoleViewsByUserID(userID int64) ([]*UserRoleView, error)
GetUserRoleViewsByUserID gets a user's role information
func (*DB) UpdateCharacter ¶
func (db *DB) UpdateCharacter(characterUpdate *CharacterUpdate) (*Character, error)
UpdateCharacter updates an existing entry in the characters table in our database
func (*DB) UpdateMatch ¶
func (db *DB) UpdateMatch(matchUpdate *MatchUpdate) (int64, error)
UpdateMatch updates an entry in the matches table with the given data
func (*DB) UpdateUserCharacter ¶
func (db *DB) UpdateUserCharacter(userCharacterUpdate *UserCharacterUpdate) (int64, error)
UpdateUserCharacter updates an existing entry in the user_characters table
func (*DB) UpdateUserDefaultUserCharacter ¶
func (db *DB) UpdateUserDefaultUserCharacter(userCharUpdate *UserDefaultUserCharacterUpdate) (int64, error)
UpdateUserDefaultUserCharacter updates a user's default user character
func (*DB) UpdateUserHashedPassword ¶
func (db *DB) UpdateUserHashedPassword(hashedPasswordUpdate *UserHashedPasswordUpdate) (int64, error)
UpdateUserHashedPassword updates a user's hashed password
func (*DB) UpdateUserProfile ¶
func (db *DB) UpdateUserProfile(profileUpdate *UserProfileUpdate) (int64, error)
UpdateUserProfile updates an entry in the users table with the given data
func (*DB) UpdateUserRefreshToken ¶
func (db *DB) UpdateUserRefreshToken(refreshUpdate *UserRefreshUpdate) (int64, error)
UpdateUserRefreshToken updates a user's refresh token; used for auth
func (*DB) UpdateUserResetPasswordToken ¶
func (db *DB) UpdateUserResetPasswordToken(resetPasswordUpdate *UserResetPasswordUpdate) (int64, error)
UpdateUserResetPasswordToken updates a user's reset password token; used for "forgot password"
type DatabaseManager ¶
type DatabaseManager interface {
MatchManager
MatchViewManager
UserManager
UserViewManager
UserRoleViewManager
CharacterManager
UserCharacterManager
UserCharacterViewManager
MatchTagManager
MatchTagViewManager
TagManager
}
DatabaseManager combines all of the database interactions into one
type Match ¶
type Match struct {
MatchID *int64 `json:"matchId,omitempty"`
OpponentCharacterID int64 `json:"opponentCharacterId"`
UserID int64 `json:"userId"`
OpponentCharacterGsp NullInt64JSON `json:"opponentCharacterGsp"`
UserCharacterID NullInt64JSON `json:"userCharacterId"`
UserCharacterGsp NullInt64JSON `json:"userCharacterGsp"`
UserWin NullBoolJSON `json:"userWin"`
}
Match describes the required and optional data needed to create a new match in our matches table
type MatchCreate ¶
type MatchCreate struct {
OpponentCharacterID int64 `json:"opponentCharacterId"`
UserID int64 `json:"userId"`
OpponentCharacterGsp NullInt64JSON `json:"opponentCharacterGsp"`
UserCharacterID NullInt64JSON `json:"userCharacterId"`
UserCharacterGsp NullInt64JSON `json:"userCharacterGsp"`
UserWin NullBoolJSON `json:"userWin"`
MatchTags *[]*MatchTagCreate `json:"matchTags"`
}
MatchCreate describes the data needed to create a given match in our db
type MatchDelete ¶
type MatchDelete struct {
MatchID int64 `json:"matchId"`
}
MatchDelete describes the data needed to delete a given match in our db
type MatchManager ¶
type MatchManager interface {
CreateMatch(matchCreate *MatchCreate) (int64, error)
UpdateMatch(matchUpdate *MatchUpdate) (int64, error)
DeleteMatchByMatchID(matchID int64) (int64, error)
}
MatchManager describes all of the methods used to interact with the matches table in our database
type MatchTag ¶
type MatchTag struct {
MatchTagID int64 `json:"matchTagId"`
MatchID int64 `json:"matchId"`
TagID int64 `json:"tagId"`
}
MatchTag describes a "match tag" relationship
type MatchTagCreate ¶
MatchTagCreate describes the data needed to create a "match tag" relationship
type MatchTagManager ¶
type MatchTagManager interface {
CreateMatchTags(matchTagsCreate []*MatchTagCreate) ([]int64, error)
DeleteMatchTagsByMatchID(matchID int64) ([]int64, error)
}
MatchTagManager describes all of the methods used to interact with the match_tags table in our database
type MatchTagView ¶
type MatchTagView struct {
MatchTagID int64 `json:"matchTagId"`
MatchID int64 `json:"matchId"`
TagID int64 `json:"tagId"`
TagName string `json:"tagName"`
}
MatchTagView describes a JOIN between match_tags and tags tables
type MatchTagViewManager ¶
type MatchTagViewManager interface {
GetAllMatchTagViews() ([]*MatchTagView, error)
GetMatchTagViewsByMatchID(matchID int64) ([]*MatchTagView, error)
}
MatchTagViewManager describes all of the methods used to interact with "match tag" views in our database
type MatchUpdate ¶
type MatchUpdate struct {
MatchID int64 `json:"matchId"`
OpponentCharacterID NullInt64JSON `json:"opponentCharacterId"`
OpponentCharacterGsp NullInt64JSON `json:"opponentCharacterGsp"`
UserCharacterID NullInt64JSON `json:"userCharacterId"`
UserCharacterGsp NullInt64JSON `json:"userCharacterGsp"`
UserWin NullBoolJSON `json:"userWin"`
Created NullTimeJSON `json:"created"`
MatchTags *[]*MatchTagCreate `json:"matchTags"`
}
MatchUpdate describes the data needed to update a given user's profile information
type MatchView ¶
type MatchView struct {
// Data from matches
Created time.Time `json:"created"`
UserID int64 `json:"userId"`
MatchID int64 `json:"matchId"`
OpponentCharacterID int64 `json:"opponentCharacterId"`
UserCharacterID NullInt64JSON `json:"userCharacterId"`
OpponentCharacterGsp NullInt64JSON `json:"opponentCharacterGsp,omitempty"`
UserCharacterGsp NullInt64JSON `json:"userCharacterGsp,omitempty"`
UserWin NullBoolJSON `json:"userWin,omitempty"`
// Data from users
UserName string `json:"userName"`
// Data from characters
OpponentCharacterName string `json:"opponentCharacterName"`
UserCharacterName NullStringJSON `json:"userCharacterName,omitempty"`
OpponentCharacterImg string `json:"opponentCharacterImage"`
UserCharacterImg NullStringJSON `json:"userCharacterImage"`
// Data from user characters
AltCostume NullInt64JSON `json:"altCostume,omitempty"`
// Data from match_tags; added seperately from the SQL Joins
MatchTags []*MatchTagView `json:"matchTags"`
}
MatchView desribes a JOIN between the matches, users, and characters tables, containing all of the data necessary to show a "match" in the front end
type MatchViewManager ¶
type MatchViewManager interface {
GetMatchViewByMatchID(matchID int64) (*MatchView, error)
GetAllMatchViews() ([]*MatchView, error)
}
MatchViewManager describes all of the methods used to interact with match views in our database (data joined between match, character, user, etc)
type NullBoolJSON ¶
NullBoolJSON extends sql.NullBool to nicely (Un)Marshal JSON
func (*NullBoolJSON) MarshalJSON ¶
func (nb *NullBoolJSON) MarshalJSON() ([]byte, error)
MarshalJSON handles sql.NullBool to JSON
func (*NullBoolJSON) UnmarshalJSON ¶
func (nb *NullBoolJSON) UnmarshalJSON(data []byte) error
UnmarshalJSON handles JSON to sql.NullBool
type NullInt64JSON ¶
NullInt64JSON extends sql.NullInt64 to nicely (Un)Marshal JSON
func (*NullInt64JSON) MarshalJSON ¶
func (ni *NullInt64JSON) MarshalJSON() ([]byte, error)
MarshalJSON handles sql.NullInt64 to JSON
func (*NullInt64JSON) UnmarshalJSON ¶
func (ni *NullInt64JSON) UnmarshalJSON(data []byte) error
UnmarshalJSON handles JSON to sql.NullInt64
type NullStringJSON ¶
type NullStringJSON struct {
sql.NullString
}
NullStringJSON extends sql.NullString to nicely (Un)Marshal JSON
func (*NullStringJSON) MarshalJSON ¶
func (ns *NullStringJSON) MarshalJSON() ([]byte, error)
MarshalJSON handles sql.NullString to JSON
func (*NullStringJSON) UnmarshalJSON ¶
func (ns *NullStringJSON) UnmarshalJSON(data []byte) error
UnmarshalJSON handles JSON to sql.NullString
type NullTimeJSON ¶
NullTimeJSON extends pq.NullTime to nicely (Un)Marshal JSON
func (*NullTimeJSON) MarshalJSON ¶
func (nt *NullTimeJSON) MarshalJSON() ([]byte, error)
MarshalJSON handles pq.NullTime to JSON
func (*NullTimeJSON) UnmarshalJSON ¶
func (nt *NullTimeJSON) UnmarshalJSON(data []byte) error
UnmarshalJSON handles JSON to pq.NullTime
type TagCreate ¶
type TagCreate struct {
TagName string `json:"tagName"`
}
TagCreate describes the data needed to create a new tag in our database
type TagDelete ¶
type TagDelete struct {
TagID int64 `json:"tagId"`
}
TagDelete describes the data needed to delete a given tag in our database
type TagManager ¶
type TagManager interface {
GetAllTags() ([]*Tag, error)
GetTagByTagID(tagID int) (*Tag, error)
CreateTag(tagCreate *TagCreate) (int, error)
UpdateTag(tagUpdate *TagUpdate) (int, error)
DeleteTagByTagID(tagID int64) (int64, error)
}
TagManager describes all of the methods used to interact with the tags table in our database
type UserCharacter ¶
type UserCharacter struct {
UserCharacterID int64 `json:"userCharacterId"`
UserID int64 `json:"userId"`
CharacterID int64 `json:"characterId"`
CharacterGsp NullInt64JSON `json:"characterGsp"`
AltCostume NullInt64JSON `json:"altCostume"`
}
UserCharacter describes the required and optional data needed to create a new "saved character" in our user_characters table
type UserCharacterCreate ¶
type UserCharacterCreate struct {
UserID int64 `json:"userId"`
CharacterID int64 `json:"characterId"`
CharacterGsp NullInt64JSON `json:"characterGsp"`
AltCostume NullInt64JSON `json:"altCostume"`
}
UserCharacterCreate describes the data needed to create a given "saved character" in our db
type UserCharacterDelete ¶
type UserCharacterDelete struct {
UserID int64 `json:"userId"`
UserCharacterID NullInt64JSON `json:"userCharacterId"`
}
UserCharacterDelete describes the data needed to delete a given "saved character" in our db
type UserCharacterManager ¶
type UserCharacterManager interface {
GetUserCharactersByUserID(userID int64) ([]*UserCharacter, error)
CreateUserCharacter(userCharacterCreate *UserCharacterCreate) (int64, error)
UpdateUserCharacter(userCharacterUpdate *UserCharacterUpdate) (int64, error)
DeleteUserCharacterByID(userCharacterID int64) (int64, error)
}
UserCharacterManager describes all of the methods used to int64eract with the user_characters table in our database
type UserCharacterUpdate ¶
type UserCharacterUpdate struct {
UserCharacterID int64 `json:"userCharacterId"`
UserID int64 `json:"userId"`
CharacterID NullInt64JSON `json:"characterId"`
CharacterGsp NullInt64JSON `json:"characterGsp"`
AltCostume NullInt64JSON `json:"altCostume"`
}
UserCharacterUpdate describes the data needed to update a given "saved character" in our db
type UserCharacterView ¶
type UserCharacterView struct {
// Data from user_characters
UserCharacterID int64 `json:"userCharacterId"`
CharacterGsp NullInt64JSON `json:"characterGsp"`
AltCostume NullInt64JSON `json:"altCostume"`
// Data from characters
CharacterID int64 `json:"characterId"`
CharacterName string `json:"characterName"`
// Data from users
UserID int64 `json:"userId"`
}
UserCharacterView desribes a JOIN between the characters, users, and user_characters tables, containing all of the data necessary to show a "saved character" in the front end
type UserCharacterViewManager ¶
type UserCharacterViewManager interface {
GetUserCharacterViewsByUserID(userID int64) ([]*UserCharacterView, error)
GetUserCharacterViewByUserCharacterID(userCharID int64) (*UserCharacterView, error)
}
UserCharacterViewManager describes all of the methods used to int64eract with "saved characters" views in our database (data joined between users, characters, and user_characters)
type UserCreate ¶
type UserCreate struct {
UserName string `json:"userName"`
EmailAddress string `json:"emailAddress"`
HashedPassword string `json:"hashedPassword"`
}
UserCreate describes the data needed to create a new user in our db
type UserCredentialsView ¶
type UserCredentialsView struct {
EmailAddress string `json:"email"`
UserID int64 `json:"userId"`
UserName string `json:"userName"`
HashedPassword string `json:"hashedPassword"`
}
UserCredentialsView describes all of the data needed for a user's authentication credentials
type UserDefaultUserCharacterUpdate ¶
type UserDefaultUserCharacterUpdate struct {
UserID int64 `json:"userId"`
UserCharacterID NullInt64JSON `json:"userCharacterId"`
}
UserDefaultUserCharacterUpdate describes the data needed to update a given user's default user character
type UserHashedPasswordUpdate ¶
type UserHashedPasswordUpdate struct {
UserID int64 `json:"userId"`
HashedPassword string `json:"hashedPassword"`
}
UserHashedPasswordUpdate describes the data needed to update a given user's hashed password
type UserManager ¶
type UserManager interface {
GetAllUsers() ([]*User, error)
GetUserIDByEmail(email string) (int64, error)
GetUserResetPasswordTokenByUserID(int64) (string, error)
UpdateUserProfile(profileUpdate *UserProfileUpdate) (int64, error)
UpdateUserRefreshToken(refreshUpdate *UserRefreshUpdate) (int64, error)
UpdateUserResetPasswordToken(resetPasswordUpdate *UserResetPasswordUpdate) (int64, error)
UpdateUserHashedPassword(hashedPasswordUpdate *UserHashedPasswordUpdate) (int64, error)
UpdateUserDefaultUserCharacter(userCharUpdate *UserDefaultUserCharacterUpdate) (int64, error)
CreateUser(userCreate *UserCreate) (int64, error)
}
UserManager describes all of the methods used to interact with the users table in our database
type UserProfileUpdate ¶
UserProfileUpdate describes the data needed to update a given user's profile information
type UserProfileView ¶
type UserProfileView struct {
// Data from Users
UserID int64 `json:"userId"`
UserName string `json:"userName"`
EmailAddress string `json:"emailAddress"`
Created time.Time `json:"created"`
// Data from characters
DefaultCharacterID NullInt64JSON `json:"defaultCharacterId"`
DefaultCharacterName NullStringJSON `json:"defaultCharacterName"`
// Data from user_characters
DefaultUserCharacterID NullInt64JSON `json:"defaultUserCharacterId"`
DefaultUserCharacterGsp NullInt64JSON `json:"defaultUserCharacterGsp"`
// Data from user_roles
UserRoles []*UserRoleView `json:"userRoles"`
}
UserProfileView describes all of the required and optional data needed for a user's public
type UserRefreshUpdate ¶
type UserRefreshUpdate struct {
UserID int64 `json:"userId"`
RefreshToken string `json:"refreshToken"`
}
UserRefreshUpdate describes the data needed to update a given users refresh token
type UserResetPasswordUpdate ¶
type UserResetPasswordUpdate struct {
UserID int64 `json:"userId"`
ResetPasswordToken string `json:"resetPasswordToken"`
}
UserResetPasswordUpdate describes the data needed to update a given user's reset password token
type UserRoleView ¶
type UserRoleView struct {
UserRoleID int64 `json:"userRoleId"`
UserID int64 `json:"userId"`
RoleID int64 `json:"roleId"`
RoleName string `json:"roleName"`
}
UserRoleView describes the data relevant to a user's role
type UserRoleViewManager ¶
type UserRoleViewManager interface {
GetUserRoleViewsByUserID(userID int64) ([]*UserRoleView, error)
}
UserRoleViewManager describes all of the methods used to interact with our user_roles table in our database
type UserViewManager ¶
type UserViewManager interface {
GetUserProfileViewByUserID(userID int64) (*UserProfileView, error)
GetUserCredentialsViewByEmail(email string) (*UserCredentialsView, error)
}
UserViewManager describes all of the methods used to interact with user views in our database (data joined between match, character, user, etc)