databaseAccess

package
v0.0.0-...-6690001 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConflictThresholdSeconds = 120
)

Variables

var usersDAO databaseAccess.UsersDAO

Functions

func GetScannedAllLoLTeamStubs

func GetScannedAllLoLTeamStubs(rows *sql.Rows) ([]*dataModel.LoLTeamStub, error)

func GetScannedAllTeamWithManagers

func GetScannedAllTeamWithManagers(rows *sql.Rows) ([]*dataModel.TeamWithManagers, error)

func GetScannedAllTeamWithPlayers

func GetScannedAllTeamWithPlayers(rows *sql.Rows) ([]*dataModel.TeamWithPlayers, error)

func GetScannedAllTeamWithRosters

func GetScannedAllTeamWithRosters(rows *sql.Rows) ([]*dataModel.TeamWithRosters, error)

func GetScannedAvailability

func GetScannedAvailability(rows squirrel.RowScanner) (*dataModel.Availability, error)

func GetScannedGame

func GetScannedGame(rows squirrel.RowScanner) (*dataModel.Game, error)

func GetScannedLeague

func GetScannedLeague(rows squirrel.RowScanner) (*dataModel.League, error)

func GetScannedLeaguePermissionsCore

func GetScannedLeaguePermissionsCore(rows squirrel.RowScanner) (*dataModel.LeaguePermissionsCore, error)

LeaguePermissionsCore

func GetScannedLoLTeamStub

func GetScannedLoLTeamStub(rows *sql.Rows) (*dataModel.LoLTeamStub, error)

func GetScannedTeamDisplay

func GetScannedTeamDisplay(rows squirrel.RowScanner) (*dataModel.TeamDisplay, error)

func GetScannedTeamPermissions

func GetScannedTeamPermissions(rows squirrel.RowScanner) (*dataModel.TeamPermissions, error)

func GetScannedTeamPermissionsCore

func GetScannedTeamPermissionsCore(rows squirrel.RowScanner) (*dataModel.TeamPermissionsCore, error)

func GetScannedTeamWithPlayers

func GetScannedTeamWithPlayers(rows *sql.Rows) (*dataModel.TeamWithPlayers, error)

func GetScannedTeamWithRosters

func GetScannedTeamWithRosters(rows *sql.Rows) (*dataModel.TeamWithRosters, error)

func GetScannedUser

func GetScannedUser(rows squirrel.RowScanner) (*dataModel.User, error)

func GetScannedUserAuthenticationDTO

func GetScannedUserAuthenticationDTO(rows squirrel.RowScanner) (*dataModel.UserAuthenticationDTO, error)

func GetScannedWeeklyAvailability

func GetScannedWeeklyAvailability(rows squirrel.RowScanner) (*dataModel.WeeklyAvailability, error)

func Init

func Init(conf config.Config)

func ScanRows

func ScanRows(statement squirrel.SelectBuilder, out RowArr) error

Types

type AvailabilityArray

type AvailabilityArray struct {
	// contains filtered or unexported fields
}

func (*AvailabilityArray) Scan

func (r *AvailabilityArray) Scan(rows *sql.Rows) error

type GameArray

type GameArray struct {
	// contains filtered or unexported fields
}

func (*GameArray) Scan

func (r *GameArray) Scan(rows *sql.Rows) error

type GameSqlDao

type GameSqlDao struct{}

func (*GameSqlDao) AddExternalId

func (d *GameSqlDao) AddExternalId(gameId int, externalId string) error

func (*GameSqlDao) CreateGame

func (d *GameSqlDao) CreateGame(leagueId int, gameInformation dataModel.GameCreationInformation) (int, error)

func (*GameSqlDao) DeleteGame

func (d *GameSqlDao) DeleteGame(gameId int) error

func (*GameSqlDao) DoesExistConflict

func (d *GameSqlDao) DoesExistConflict(team1Id, team2Id, gameTime int) (bool, error)

func (*GameSqlDao) DoesGameExistInLeague

func (d *GameSqlDao) DoesGameExistInLeague(leagueId, gameId int) (bool, error)

func (*GameSqlDao) GetAllGamesInLeague

func (d *GameSqlDao) GetAllGamesInLeague(leagueId int) ([]*dataModel.Game, error)

func (*GameSqlDao) GetGameInformation

func (d *GameSqlDao) GetGameInformation(gameId int) (*dataModel.Game, error)

func (*GameSqlDao) GetGameInformationFromExternalId

func (d *GameSqlDao) GetGameInformationFromExternalId(externalId string) (*dataModel.Game, error)

TODO: check all joins and see where clauses are correct

func (*GameSqlDao) GetGamesByWeek

func (d *GameSqlDao) GetGamesByWeek(leagueId, timeZone int) ([]*dataModel.CompetitionWeek, error)

func (*GameSqlDao) GetSortedGames

func (d *GameSqlDao) GetSortedGames(leagueId, teamId, limit int) (*dataModel.SortedGames, error)

func (*GameSqlDao) HasReportResultPermissions

func (d *GameSqlDao) HasReportResultPermissions(leagueId, gameId, userId int) (bool, error)

func (*GameSqlDao) ReportGame

func (d *GameSqlDao) ReportGame(gameId int, gameResult dataModel.GameResult) error

func (*GameSqlDao) ReportGameByExternalId

func (d *GameSqlDao) ReportGameByExternalId(externalId string, gameResult dataModel.GameResult) (int, int, error)

func (*GameSqlDao) RescheduleGame

func (d *GameSqlDao) RescheduleGame(gameId, gameTime int) error

type LeagueArray

type LeagueArray struct {
	// contains filtered or unexported fields
}

League

func (*LeagueArray) Scan

func (r *LeagueArray) Scan(rows *sql.Rows) error

type LeagueOfLegendsSqlDao

type LeagueOfLegendsSqlDao struct{}

func (*LeagueOfLegendsSqlDao) CreateLoLPlayer

func (d *LeagueOfLegendsSqlDao) CreateLoLPlayer(leagueId, teamId int, externalId string, playerInfo dataModel.LoLPlayerCore) (int, error)

func (*LeagueOfLegendsSqlDao) CreateLoLTeamWithPlayers

func (d *LeagueOfLegendsSqlDao) CreateLoLTeamWithPlayers(
	leagueId,
	userId int,
	teamInfo dataModel.TeamCore,
	players []*dataModel.LoLPlayerCore,
	iconSmall, iconLarge string) (int, error)

func (*LeagueOfLegendsSqlDao) CreateTournamentCode

func (d *LeagueOfLegendsSqlDao) CreateTournamentCode(gameId int, tournamentCode string) error

func (*LeagueOfLegendsSqlDao) GetAllLoLTeamStubInLeague

func (d *LeagueOfLegendsSqlDao) GetAllLoLTeamStubInLeague(leagueId int) ([]*dataModel.LoLTeamStub, error)

func (*LeagueOfLegendsSqlDao) GetChampionStats

func (d *LeagueOfLegendsSqlDao) GetChampionStats(leagueId int) ([]*dataModel.LoLChampionStats, error)

func (*LeagueOfLegendsSqlDao) GetLoLTeamStub

func (d *LeagueOfLegendsSqlDao) GetLoLTeamStub(teamId int) (*dataModel.LoLTeamStub, error)

func (*LeagueOfLegendsSqlDao) GetPlayerStats

func (d *LeagueOfLegendsSqlDao) GetPlayerStats(leagueId int) ([]*dataModel.LoLPlayerStats, error)

func (*LeagueOfLegendsSqlDao) GetTeamStats

func (d *LeagueOfLegendsSqlDao) GetTeamStats(leagueId int) ([]*dataModel.LoLTeamStats, error)

func (*LeagueOfLegendsSqlDao) GetTournamentCode

func (d *LeagueOfLegendsSqlDao) GetTournamentCode(gameId int) (string, error)

func (*LeagueOfLegendsSqlDao) GetTournamentId

func (d *LeagueOfLegendsSqlDao) GetTournamentId(leagueId int) (int, error)

func (*LeagueOfLegendsSqlDao) HasTournamentCode

func (d *LeagueOfLegendsSqlDao) HasTournamentCode(gameId int) (bool, error)

func (*LeagueOfLegendsSqlDao) LeagueHasRegisteredTournament

func (d *LeagueOfLegendsSqlDao) LeagueHasRegisteredTournament(leagueId int) (bool, error)

func (*LeagueOfLegendsSqlDao) RegisterTournamentProvider

func (d *LeagueOfLegendsSqlDao) RegisterTournamentProvider(leagueId, providerId, tournamentId int) error

func (*LeagueOfLegendsSqlDao) ReportEndGameStats

func (d *LeagueOfLegendsSqlDao) ReportEndGameStats(leagueId, gameId int, match *dataModel.LoLMatchInformation) error

func (*LeagueOfLegendsSqlDao) UpdateLoLPlayer

func (d *LeagueOfLegendsSqlDao) UpdateLoLPlayer(playerId int, externalId string, playerInfo dataModel.LoLPlayerCore) error

type LeagueSqlDao

type LeagueSqlDao struct{}

func (*LeagueSqlDao) AddAvailability

func (d *LeagueSqlDao) AddAvailability(leagueId int, availability dataModel.AvailabilityCore) (int, error)

Availabilities

func (*LeagueSqlDao) AddWeeklyAvailability

func (d *LeagueSqlDao) AddWeeklyAvailability(leagueId int, availability dataModel.WeeklyAvailabilityCore) (int, error)

func (*LeagueSqlDao) CanJoinLeague

func (d *LeagueSqlDao) CanJoinLeague(leagueId, userId int) (bool, error)

TODO: make invite system for private leagues, check if user invited in this function

func (*LeagueSqlDao) CreateLeague

func (d *LeagueSqlDao) CreateLeague(userId int, leagueInfo dataModel.LeagueCore) (int, error)

Modify League

func (*LeagueSqlDao) DeleteAvailability

func (d *LeagueSqlDao) DeleteAvailability(availabilityId int) error

func (*LeagueSqlDao) DeleteWeeklyAvailability

func (d *LeagueSqlDao) DeleteWeeklyAvailability(availabilityId int) error

func (*LeagueSqlDao) DoesAvailabilityExistInLeague

func (d *LeagueSqlDao) DoesAvailabilityExistInLeague(leagueId, availabilityId int) (bool, error)

func (*LeagueSqlDao) DoesLeagueExist

func (d *LeagueSqlDao) DoesLeagueExist(leagueId int) (bool, error)

func (*LeagueSqlDao) EditWeeklyAvailability

func (d *LeagueSqlDao) EditWeeklyAvailability(availabilityId int,
	availability dataModel.WeeklyAvailabilityCore) error

func (*LeagueSqlDao) GetAvailabilities

func (d *LeagueSqlDao) GetAvailabilities(leagueId int) ([]*dataModel.Availability, error)

func (*LeagueSqlDao) GetLeagueInformation

func (d *LeagueSqlDao) GetLeagueInformation(leagueId int) (*dataModel.League, error)

func (*LeagueSqlDao) GetLeaguePermissions

func (d *LeagueSqlDao) GetLeaguePermissions(leagueId, userId int) (*dataModel.LeaguePermissionsCore, error)

func (*LeagueSqlDao) GetMarkdownFile

func (d *LeagueSqlDao) GetMarkdownFile(leagueId int) (string, error)

Markdown

func (*LeagueSqlDao) GetPublicLeagueList

func (d *LeagueSqlDao) GetPublicLeagueList() ([]*dataModel.League, error)

func (*LeagueSqlDao) GetTeamManagerInformation

func (d *LeagueSqlDao) GetTeamManagerInformation(leagueId int) ([]*dataModel.TeamWithManagers, error)

func (*LeagueSqlDao) GetWeeklyAvailabilities

func (d *LeagueSqlDao) GetWeeklyAvailabilities(leagueId int) ([]*dataModel.WeeklyAvailability, error)

func (*LeagueSqlDao) IsLeagueViewable

func (d *LeagueSqlDao) IsLeagueViewable(leagueId, userId int) (bool, error)

func (*LeagueSqlDao) IsNameInUse

func (d *LeagueSqlDao) IsNameInUse(leagueId int, name string) (bool, error)

func (*LeagueSqlDao) JoinLeague

func (d *LeagueSqlDao) JoinLeague(leagueId, userId int) error

func (*LeagueSqlDao) SetLeaguePermissions

func (d *LeagueSqlDao) SetLeaguePermissions(leagueId, userId int, permissions dataModel.LeaguePermissionsCore) error

func (*LeagueSqlDao) SetMarkdownFile

func (d *LeagueSqlDao) SetMarkdownFile(leagueId int, fileName string) error

func (*LeagueSqlDao) UpdateLeague

func (d *LeagueSqlDao) UpdateLeague(leagueId int, leagueInfo dataModel.LeagueCore) error

type RowArr

type RowArr interface {
	Scan(*sql.Rows) error
}

type TeamDisplayArray

type TeamDisplayArray struct {
	// contains filtered or unexported fields
}

TeamDisplay

func (*TeamDisplayArray) Scan

func (r *TeamDisplayArray) Scan(rows *sql.Rows) error

type TeamPermissionsArray

type TeamPermissionsArray struct {
	// contains filtered or unexported fields
}

func (*TeamPermissionsArray) Scan

func (r *TeamPermissionsArray) Scan(rows *sql.Rows) error

type TeamPermissionsCoreArray

type TeamPermissionsCoreArray struct {
	// contains filtered or unexported fields
}

TeamPermissionsCore

func (*TeamPermissionsCoreArray) Scan

func (r *TeamPermissionsCoreArray) Scan(rows *sql.Rows) error

type TeamSqlDao

type TeamSqlDao struct{}

func (*TeamSqlDao) ChangeManagerPermissions

func (d *TeamSqlDao) ChangeManagerPermissions(teamId, userId int, teamPermissionInformation dataModel.TeamPermissionsCore) error

func (*TeamSqlDao) CreatePlayer

func (d *TeamSqlDao) CreatePlayer(leagueId, teamId int, playerInfo dataModel.PlayerCore) (int, error)

Players

func (*TeamSqlDao) CreateTeam

func (d *TeamSqlDao) CreateTeam(leagueId, userId int, teamInfo dataModel.TeamCore) (int, error)

func (*TeamSqlDao) CreateTeamWithIcon

func (d *TeamSqlDao) CreateTeamWithIcon(leagueId, userId int, teamInfo dataModel.TeamCore,
	iconSmall, iconLarge string) (int, error)

func (*TeamSqlDao) CreateTeamWithPlayers

func (d *TeamSqlDao) CreateTeamWithPlayers(leagueId,
	userId int,
	teamInfo dataModel.TeamCore,
	players []dataModel.PlayerCore,
	iconSmall, iconLarge string) (int, error)

func (*TeamSqlDao) DeletePlayer

func (d *TeamSqlDao) DeletePlayer(playerId int) error

func (*TeamSqlDao) DeleteTeam

func (d *TeamSqlDao) DeleteTeam(teamId int) error

func (*TeamSqlDao) DoesPlayerExist

func (d *TeamSqlDao) DoesPlayerExist(leagueId, teamId, playerId int) (bool, error)

func (*TeamSqlDao) DoesTeamExistInLeague

func (d *TeamSqlDao) DoesTeamExistInLeague(leagueId, teamId int) (bool, error)

func (*TeamSqlDao) GetAllTeamDisplaysInLeague

func (d *TeamSqlDao) GetAllTeamDisplaysInLeague(leagueId int) ([]*dataModel.TeamDisplay, error)

func (*TeamSqlDao) GetAllTeamsInLeague

func (d *TeamSqlDao) GetAllTeamsInLeague(leagueId int) ([]*dataModel.TeamWithPlayers, error)

func (*TeamSqlDao) GetAllTeamsInLeagueWithRosters

func (d *TeamSqlDao) GetAllTeamsInLeagueWithRosters(leagueId int) ([]*dataModel.TeamWithRosters, error)

func (*TeamSqlDao) GetTeamInformation

func (d *TeamSqlDao) GetTeamInformation(teamId int) (*dataModel.TeamWithPlayers, error)

func (*TeamSqlDao) GetTeamPermissions

func (d *TeamSqlDao) GetTeamPermissions(teamId, userId int) (*dataModel.TeamPermissionsCore, error)

func (*TeamSqlDao) GetTeamWithRosters

func (d *TeamSqlDao) GetTeamWithRosters(teamId int) (*dataModel.TeamWithRosters, error)

func (*TeamSqlDao) IsInfoInUse

func (d *TeamSqlDao) IsInfoInUse(leagueId, teamId int, name, tag string) (bool, string, error)

func (*TeamSqlDao) IsTeamActive

func (d *TeamSqlDao) IsTeamActive(leagueId, teamId int) (bool, error)

func (*TeamSqlDao) UpdatePlayer

func (d *TeamSqlDao) UpdatePlayer(playerId int, playerInfo dataModel.PlayerCore) error

func (*TeamSqlDao) UpdateTeam

func (d *TeamSqlDao) UpdateTeam(teamId int, teamInformation dataModel.TeamCore) error

func (*TeamSqlDao) UpdateTeamIcon

func (d *TeamSqlDao) UpdateTeamIcon(teamId int, small, large string) error

type TeamWithPlayersArray

type TeamWithPlayersArray struct {
	// contains filtered or unexported fields
}

TeamWithPlayers

func (*TeamWithPlayersArray) Scan

func (r *TeamWithPlayersArray) Scan(rows *sql.Rows) error

type UserSqlDao

type UserSqlDao struct{}

func (*UserSqlDao) CreateUser

func (d *UserSqlDao) CreateUser(email, salt, hash string) (int, error)

func (*UserSqlDao) GetAuthenticationInformation

func (d *UserSqlDao) GetAuthenticationInformation(email string) (*dataModel.UserAuthenticationDTO, error)

func (*UserSqlDao) GetUserProfile

func (d *UserSqlDao) GetUserProfile(userId int) (*dataModel.User, error)

func (*UserSqlDao) GetUserWithPermissions

func (d *UserSqlDao) GetUserWithPermissions(leagueId, userId int) (*dataModel.UserWithPermissions, error)

func (*UserSqlDao) IsEmailInUse

func (d *UserSqlDao) IsEmailInUse(email string) (bool, error)

type WeeklyAvailabilityArray

type WeeklyAvailabilityArray struct {
	// contains filtered or unexported fields
}

func (*WeeklyAvailabilityArray) Scan

func (r *WeeklyAvailabilityArray) Scan(rows *sql.Rows) error

Jump to

Keyboard shortcuts

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