Documentation
¶
Overview ¶
Package mysql provides the underlying connection used by the Database interface, using a MySQL connection.
Index ¶
- type DatabaseConnection
- func (c *DatabaseConnection) Connect() error
- func (c *DatabaseConnection) DeleteAccount(accountID int64) error
- func (c *DatabaseConnection) DeleteApplication(appID int64) error
- func (c *DatabaseConnection) DeleteCharacter(characterID int64) error
- func (c *DatabaseConnection) DeleteGroup(groupID int64) error
- func (c *DatabaseConnection) DeleteGroupRole(groupRoleID int64) error
- func (c *DatabaseConnection) DeleteRole(roleID int64) error
- func (c *DatabaseConnection) DeleteUser(userID int64) error
- func (c *DatabaseConnection) DeleteUserRole(userRoleID int64) error
- func (c *DatabaseConnection) LoadAccount(accountID int64) (*models.Account, error)
- func (c *DatabaseConnection) LoadAllAccounts() ([]*models.Account, error)
- func (c *DatabaseConnection) LoadAllAccountsForUser(userID int64) ([]*models.Account, error)
- func (c *DatabaseConnection) LoadAllApplications() ([]*models.Application, error)
- func (c *DatabaseConnection) LoadAllApplicationsForUser(userID int64) ([]*models.Application, error)
- func (c *DatabaseConnection) LoadAllCharacters() ([]*models.Character, error)
- func (c *DatabaseConnection) LoadAllCharactersForAccount(accountID int64) ([]*models.Character, error)
- func (c *DatabaseConnection) LoadAllCorporations() ([]*models.Corporation, error)
- func (c *DatabaseConnection) LoadAllGroupRoles() ([]*models.GroupRole, error)
- func (c *DatabaseConnection) LoadAllGroupRolesForGroup(groupID int64) ([]*models.GroupRole, error)
- func (c *DatabaseConnection) LoadAllGroups() ([]*models.Group, error)
- func (c *DatabaseConnection) LoadAllGroupsForUser(userID int64) ([]*models.Group, error)
- func (c *DatabaseConnection) LoadAllRoles() ([]*models.Role, error)
- func (c *DatabaseConnection) LoadAllUserRoles() ([]*models.UserRole, error)
- func (c *DatabaseConnection) LoadAllUserRolesForUser(userID int64) ([]*models.UserRole, error)
- func (c *DatabaseConnection) LoadAllUsers() ([]*models.User, error)
- func (c *DatabaseConnection) LoadApplication(applicationID int64) (*models.Application, error)
- func (c *DatabaseConnection) LoadAvailableGroupRolesForGroup(groupID int64) ([]*models.Role, error)
- func (c *DatabaseConnection) LoadAvailableGroupsForUser(userID int64) ([]*models.Group, error)
- func (c *DatabaseConnection) LoadAvailableUserRolesForUser(userID int64) ([]*models.Role, error)
- func (c *DatabaseConnection) LoadCharacter(characterID int64) (*models.Character, error)
- func (c *DatabaseConnection) LoadCorporation(corporationID int64) (*models.Corporation, error)
- func (c *DatabaseConnection) LoadCorporationFromEVECorporationID(eveCorporationID int64) (*models.Corporation, error)
- func (c *DatabaseConnection) LoadCorporationNameFromID(corporationID int64) (string, error)
- func (c *DatabaseConnection) LoadGroup(groupID int64) (*models.Group, error)
- func (c *DatabaseConnection) LoadGroupRole(groupRoleID int64) (*models.GroupRole, error)
- func (c *DatabaseConnection) LoadPasswordForUser(username string) (string, error)
- func (c *DatabaseConnection) LoadRole(roleID int64) (*models.Role, error)
- func (c *DatabaseConnection) LoadUser(userID int64) (*models.User, error)
- func (c *DatabaseConnection) LoadUserFromUsername(username string) (*models.User, error)
- func (c *DatabaseConnection) LoadUserRole(userRoleID int64) (*models.UserRole, error)
- func (c *DatabaseConnection) QueryUserIDExists(userID int64) (bool, error)
- func (c *DatabaseConnection) QueryUserNameEmailExists(username string, email string) (bool, error)
- func (c *DatabaseConnection) RawQuery(query string, v ...interface{}) ([]map[string]interface{}, error)
- func (c *DatabaseConnection) RemoveAPIKeyFromUser(user *models.User, apiKeyID int64) (*models.User, error)
- func (c *DatabaseConnection) RemoveGroupRoleFromGroup(groupID int64, roleID int64) (*models.Group, error)
- func (c *DatabaseConnection) RemoveUserFromGroup(userID int64, groupID int64) (*models.User, error)
- func (c *DatabaseConnection) RemoveUserRoleFromUser(userID int64, roleID int64) (*models.User, error)
- func (c *DatabaseConnection) SaveAccount(account *models.Account) (*models.Account, error)
- func (c *DatabaseConnection) SaveAllGroupsForUser(userID int64, groups []*models.Group) ([]*models.Group, error)
- func (c *DatabaseConnection) SaveApplication(application *models.Application) (*models.Application, error)
- func (c *DatabaseConnection) SaveCSRFFailure(csrfFailure *models.CSRFFailure) error
- func (c *DatabaseConnection) SaveCharacter(character *models.Character) (*models.Character, error)
- func (c *DatabaseConnection) SaveCorporation(corporation *models.Corporation) (*models.Corporation, error)
- func (c *DatabaseConnection) SaveGroup(group *models.Group) (*models.Group, error)
- func (c *DatabaseConnection) SaveGroupRole(groupRole *models.GroupRole) (*models.GroupRole, error)
- func (c *DatabaseConnection) SaveLoginAttempt(loginAttempt *models.LoginAttempt) error
- func (c *DatabaseConnection) SaveRole(role *models.Role) (*models.Role, error)
- func (c *DatabaseConnection) SaveUser(user *models.User) (*models.User, error)
- func (c *DatabaseConnection) SaveUserRole(userRole *models.UserRole) (*models.UserRole, error)
- func (c *DatabaseConnection) ToggleGroupRoleGranted(roleID int64) (*models.GroupRole, error)
- func (c *DatabaseConnection) ToggleUserRoleGranted(roleID int64) (*models.UserRole, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseConnection ¶
type DatabaseConnection struct { // Config stores the current configuration values being used Config *misc.Configuration // contains filtered or unexported fields }
DatabaseConnection provides an implementation of the Connection interface using a MySQL database
func (*DatabaseConnection) Connect ¶
func (c *DatabaseConnection) Connect() error
Connect tries to establish a connection to the MySQL backend, returning an error if the attempt failed
func (*DatabaseConnection) DeleteAccount ¶
func (c *DatabaseConnection) DeleteAccount(accountID int64) error
DeleteAccount removes an account and all associated characters from the MySQL database
func (*DatabaseConnection) DeleteApplication ¶
func (c *DatabaseConnection) DeleteApplication(appID int64) error
DeleteApplication remove an application from the MySQL database
func (*DatabaseConnection) DeleteCharacter ¶
func (c *DatabaseConnection) DeleteCharacter(characterID int64) error
DeleteCharacter removes a character from the MySQL database
func (*DatabaseConnection) DeleteGroup ¶
func (c *DatabaseConnection) DeleteGroup(groupID int64) error
DeleteGroup removes a group and all associated group memberships and roles from the MySQL database
func (*DatabaseConnection) DeleteGroupRole ¶
func (c *DatabaseConnection) DeleteGroupRole(groupRoleID int64) error
DeleteGroupRole removes a group role from the MySQL database
func (*DatabaseConnection) DeleteRole ¶
func (c *DatabaseConnection) DeleteRole(roleID int64) error
DeleteRole removes a role and all user and group roles associated from the MySQL database
func (*DatabaseConnection) DeleteUser ¶
func (c *DatabaseConnection) DeleteUser(userID int64) error
DeleteUser removes a user and all assoicated group memberships, roles and accounts from the MySQL database
func (*DatabaseConnection) DeleteUserRole ¶
func (c *DatabaseConnection) DeleteUserRole(userRoleID int64) error
DeleteUserRole removes a user role from the MySQL database
func (*DatabaseConnection) LoadAccount ¶
func (c *DatabaseConnection) LoadAccount(accountID int64) (*models.Account, error)
LoadAccount retrieves the account with the given ID from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAllAccounts ¶
func (c *DatabaseConnection) LoadAllAccounts() ([]*models.Account, error)
LoadAllAccounts retrieves all accounts from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAllAccountsForUser ¶
func (c *DatabaseConnection) LoadAllAccountsForUser(userID int64) ([]*models.Account, error)
LoadAllAccountsForUser retrieves all accounts associated with the given user from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAllApplications ¶
func (c *DatabaseConnection) LoadAllApplications() ([]*models.Application, error)
LoadAllApplications retrieves all applications from the database, returning an error if the query failed
func (*DatabaseConnection) LoadAllApplicationsForUser ¶
func (c *DatabaseConnection) LoadAllApplicationsForUser(userID int64) ([]*models.Application, error)
LoadAllApplicationsForUser retrieves all applications associated with the given user from the database, returning an error if the query failed
func (*DatabaseConnection) LoadAllCharacters ¶
func (c *DatabaseConnection) LoadAllCharacters() ([]*models.Character, error)
LoadAllCharacters retrieves all characters from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAllCharactersForAccount ¶
func (c *DatabaseConnection) LoadAllCharactersForAccount(accountID int64) ([]*models.Character, error)
LoadAllCharactersForAccount retrieves all characters associated with the given account from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAllCorporations ¶
func (c *DatabaseConnection) LoadAllCorporations() ([]*models.Corporation, error)
LoadAllCorporations retrieves all corporations from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAllGroupRoles ¶
func (c *DatabaseConnection) LoadAllGroupRoles() ([]*models.GroupRole, error)
LoadAllGroupRoles retrieves all group roles (and their associated roles) from the database, returning an error if the query failed
func (*DatabaseConnection) LoadAllGroupRolesForGroup ¶
func (c *DatabaseConnection) LoadAllGroupRolesForGroup(groupID int64) ([]*models.GroupRole, error)
LoadAllGroupRolesForGroup retrieves all group roles (and their associated roles) associated with the given group from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAllGroups ¶
func (c *DatabaseConnection) LoadAllGroups() ([]*models.Group, error)
LoadAllGroups retrieves all groups (and their associated group roles) from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAllGroupsForUser ¶
func (c *DatabaseConnection) LoadAllGroupsForUser(userID int64) ([]*models.Group, error)
LoadAllGroupsForUser retrieves all groups (and their associated group roles) associated with the given user from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAllRoles ¶
func (c *DatabaseConnection) LoadAllRoles() ([]*models.Role, error)
LoadAllRoles retrieves all roles from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAllUserRoles ¶
func (c *DatabaseConnection) LoadAllUserRoles() ([]*models.UserRole, error)
LoadAllUserRoles retrieves all user roles (and their associated roles) from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAllUserRolesForUser ¶
func (c *DatabaseConnection) LoadAllUserRolesForUser(userID int64) ([]*models.UserRole, error)
LoadAllUserRolesForUser retrieves all user roles (and their associated roles) associated with the given user from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAllUsers ¶
func (c *DatabaseConnection) LoadAllUsers() ([]*models.User, error)
LoadAllUsers retrieves all users (and their associates groups and user roles) from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadApplication ¶
func (c *DatabaseConnection) LoadApplication(applicationID int64) (*models.Application, error)
LoadApplication retrieves the application with the given application ID from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAvailableGroupRolesForGroup ¶
func (c *DatabaseConnection) LoadAvailableGroupRolesForGroup(groupID int64) ([]*models.Role, error)
LoadAvailableGroupRolesForGroup retrieves all available group roles for the given group from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAvailableGroupsForUser ¶
func (c *DatabaseConnection) LoadAvailableGroupsForUser(userID int64) ([]*models.Group, error)
LoadAvailableGroupsForUser retrieves all available groups (and their associated group roles) associated with the given user from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadAvailableUserRolesForUser ¶
func (c *DatabaseConnection) LoadAvailableUserRolesForUser(userID int64) ([]*models.Role, error)
LoadAvailableUserRolesForUser retrieves all available user roles for the given user from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadCharacter ¶
func (c *DatabaseConnection) LoadCharacter(characterID int64) (*models.Character, error)
LoadCharacter retrieves the character with the given ID from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadCorporation ¶
func (c *DatabaseConnection) LoadCorporation(corporationID int64) (*models.Corporation, error)
LoadCorporation retrieves the corporation with the given ID from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadCorporationFromEVECorporationID ¶
func (c *DatabaseConnection) LoadCorporationFromEVECorporationID(eveCorporationID int64) (*models.Corporation, error)
LoadCorporationFromEVECorporationID retrieves the corporation with the given EVE Online corporation ID from the database, returning an error if the query failed
func (*DatabaseConnection) LoadCorporationNameFromID ¶
func (c *DatabaseConnection) LoadCorporationNameFromID(corporationID int64) (string, error)
LoadCorporationNameFromID retrieves the name of the corporation with the given ID, returning an error if the query failed
func (*DatabaseConnection) LoadGroup ¶
func (c *DatabaseConnection) LoadGroup(groupID int64) (*models.Group, error)
LoadGroup retrieves the group (and its associated group roles) with the given ID from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadGroupRole ¶
func (c *DatabaseConnection) LoadGroupRole(groupRoleID int64) (*models.GroupRole, error)
LoadGroupRole retrieves the group role (and its associated role) with the given ID from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadPasswordForUser ¶
func (c *DatabaseConnection) LoadPasswordForUser(username string) (string, error)
LoadPasswordForUser retrieves the password associated with the given username from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadRole ¶
func (c *DatabaseConnection) LoadRole(roleID int64) (*models.Role, error)
LoadRole retrieves the role with the given ID from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadUser ¶
func (c *DatabaseConnection) LoadUser(userID int64) (*models.User, error)
LoadUser retrieves the user (and its associated groups and user roles) with the given ID from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) LoadUserFromUsername ¶
func (c *DatabaseConnection) LoadUserFromUsername(username string) (*models.User, error)
LoadUserFromUsername retrieves the user (and its associated groups and user roles) with the given username from the database, returning an error if the query failed
func (*DatabaseConnection) LoadUserRole ¶
func (c *DatabaseConnection) LoadUserRole(userRoleID int64) (*models.UserRole, error)
LoadUserRole retrieves the user role (and its associated role) with the given ID from the MySQL database, returning an error if the query failed
func (*DatabaseConnection) QueryUserIDExists ¶
func (c *DatabaseConnection) QueryUserIDExists(userID int64) (bool, error)
QueryUserIDExists checks whether a user with the given user ID exists in the database, returning an error if the query failed
func (*DatabaseConnection) QueryUserNameEmailExists ¶
func (c *DatabaseConnection) QueryUserNameEmailExists(username string, email string) (bool, error)
QueryUserNameEmailExists checks whether a user with the given username or email address exists in the database, returning an error if the query failed
func (*DatabaseConnection) RawQuery ¶
func (c *DatabaseConnection) RawQuery(query string, v ...interface{}) ([]map[string]interface{}, error)
RawQuery performs a raw MySQL query and returns a map of interfaces containing the retrieve data. An error is returned if the query failed
func (*DatabaseConnection) RemoveAPIKeyFromUser ¶
func (c *DatabaseConnection) RemoveAPIKeyFromUser(user *models.User, apiKeyID int64) (*models.User, error)
RemoveAPIKeyFromUser removes an API key from the given user, updates the MySQL database and returns the updated model
func (*DatabaseConnection) RemoveGroupRoleFromGroup ¶
func (c *DatabaseConnection) RemoveGroupRoleFromGroup(groupID int64, roleID int64) (*models.Group, error)
RemoveGroupRoleFromGroup removes a group role from the given group, updates the database and returns the updated model
func (*DatabaseConnection) RemoveUserFromGroup ¶
RemoveUserFromGroup removes a user from the given group, updates the MySQL database and returns the updated model
func (*DatabaseConnection) RemoveUserRoleFromUser ¶
func (c *DatabaseConnection) RemoveUserRoleFromUser(userID int64, roleID int64) (*models.User, error)
RemoveUserRoleFromUser removes a user role from the given user, updates the database and returns the updated model
func (*DatabaseConnection) SaveAccount ¶
SaveAccount saves an account to the MySQL database, returning the updated model or an error if the query failed
func (*DatabaseConnection) SaveAllGroupsForUser ¶
func (c *DatabaseConnection) SaveAllGroupsForUser(userID int64, groups []*models.Group) ([]*models.Group, error)
SaveAllGroupsForUser saves all group memberships for the user
func (*DatabaseConnection) SaveApplication ¶
func (c *DatabaseConnection) SaveApplication(application *models.Application) (*models.Application, error)
SaveApplication saves an application to the MySQL database, returning the updated model or an error if the query failed
func (*DatabaseConnection) SaveCSRFFailure ¶
func (c *DatabaseConnection) SaveCSRFFailure(csrfFailure *models.CSRFFailure) error
SaveCSRFFailure saves a CSRF failure to the MySQL database, returning an error if the query failed
func (*DatabaseConnection) SaveCharacter ¶
SaveCharacter saves a character to the MySQL database, returning the updated model or an error if the query failed
func (*DatabaseConnection) SaveCorporation ¶
func (c *DatabaseConnection) SaveCorporation(corporation *models.Corporation) (*models.Corporation, error)
SaveCorporation saves a corporation to the MySQL database, returning the updated model or an error if the query failed
func (*DatabaseConnection) SaveGroup ¶
SaveGroup saves a group to the MySQL database, returning the updated model or an error if the query failed
func (*DatabaseConnection) SaveGroupRole ¶
SaveGroupRole saves a group role to the MySQL database, returning the updated model or an error if the query failed
func (*DatabaseConnection) SaveLoginAttempt ¶
func (c *DatabaseConnection) SaveLoginAttempt(loginAttempt *models.LoginAttempt) error
SaveLoginAttempt saves a login attempt to the MySQL database, returning an error if the query failed
func (*DatabaseConnection) SaveRole ¶
SaveRole saves a role to the MySQL database, returning the updated model or an error if the query failed
func (*DatabaseConnection) SaveUser ¶
SaveUser saves a user to the MySQL database, returning the updated model or an error if the query failed
func (*DatabaseConnection) SaveUserRole ¶
SaveUserRole saves a user role to the MySQL database, returning the updated model or an error if the query failed
func (*DatabaseConnection) ToggleGroupRoleGranted ¶
func (c *DatabaseConnection) ToggleGroupRoleGranted(roleID int64) (*models.GroupRole, error)
ToggleGroupRoleGranted toggles the granted state of the given group role
func (*DatabaseConnection) ToggleUserRoleGranted ¶
func (c *DatabaseConnection) ToggleUserRoleGranted(roleID int64) (*models.UserRole, error)
ToggleUserRoleGranted toggles the granted state of the given user role