db

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddEventParams

type AddEventParams struct {
	Tag                   string
	Type                  int32
	Name                  string
	Organization          string
	MaxLabs               int32
	Frontend              string
	Status                int32
	Exercises             string
	PublicScoreboard      bool
	DynamicScoring        bool
	DynamicMax            int32
	DynamicMin            int32
	DynamicSolveThreshold int32
	StartedAt             time.Time
	FinishExpected        time.Time
	FinishedAt            sql.NullTime
	Createdby             string
	Secretkey             string
}

type AddOrganizationParams

type AddOrganizationParams struct {
	Org           string
	Ownerusername string
	Owneremail    string
	Labquota      sql.NullInt32
}

type AddProfileChallengeParams

type AddProfileChallengeParams struct {
	Tag       string
	Name      string
	Profileid int32
}

type AddProfileParams

type AddProfileParams struct {
	Profilename string
	Secret      bool
	Orgname     string
	Description string
	Public      bool
}

type AddSolveForTeamInEventParams

type AddSolveForTeamInEventParams struct {
	Tag      string
	Eventid  int32
	Teamid   int32
	Solvedat time.Time
}

type AddTeamParams

type AddTeamParams struct {
	Tag        string
	EventID    int32
	Email      string
	Username   string
	Password   string
	CreatedAt  time.Time
	LastAccess sql.NullTime
}

type AdminUser

type AdminUser struct {
	ID           int32
	Sid          uuid.UUID
	Username     string
	Password     string
	FullName     string
	Email        string
	Role         string
	LabQuota     sql.NullInt32
	Organization string
}

type Agent

type Agent struct {
	ID        int32
	Name      string
	Url       string
	Weight    int32
	SignKey   string
	AuthKey   string
	Tls       bool
	Statelock bool
}

type CheckIfProfileExistsParams

type CheckIfProfileExistsParams struct {
	Profilename string
	Orgname     string
}

type CheckIfTeamExistsForEventParams

type CheckIfTeamExistsForEventParams struct {
	Username string
	Eventid  int32
}

type CheckIfUserExistsInOrgParams

type CheckIfUserExistsInOrgParams struct {
	Username     string
	Organization string
}

type CloseEventParams

type CloseEventParams struct {
	Newtag     string
	Finishedat sql.NullTime
	Newstatus  int32
	Oldtag     string
}

type CreateAdminUserParams

type CreateAdminUserParams struct {
	Username     string
	Password     string
	FullName     string
	Email        string
	Role         string
	Organization string
	LabQuota     sql.NullInt32
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DbConfig

type DbConfig struct {
	Host     string `yaml:"host"`
	Port     uint64 `yaml:"port"`
	DbName   string `yaml:"dbName"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

func (*DbConfig) InitConn

func (conf *DbConfig) InitConn() (*Queries, *gorm.DB, *sql.DB, error)

type DeleteEventOlderThanParams

type DeleteEventOlderThanParams struct {
	Numberofdays interface{}
	Closedstatus int32
}

type DeleteProfileByNameParams added in v1.0.0

type DeleteProfileByNameParams struct {
	Profilename string
	Orgname     string
}

type DeleteTeamParams

type DeleteTeamParams struct {
	Tag     string
	EventID int32
}

type Event

type Event struct {
	ID                    int32
	Tag                   string
	Type                  int32
	Organization          string
	Name                  string
	MaxLabs               int32
	Status                int32
	Frontend              string
	Exercises             string
	PublicScoreboard      bool
	DynamicScoring        bool
	DynamicMax            int32
	DynamicMin            int32
	DynamicSolveThreshold int32
	StartedAt             time.Time
	FinishExpected        time.Time
	FinishedAt            sql.NullTime
	Createdby             string
	Secretkey             string
}

type Frontend

type Frontend struct {
	ID       int32
	Name     string
	Image    string
	Memorymb sql.NullInt32
}

type GetAdminUserNoPwByUsernameRow

type GetAdminUserNoPwByUsernameRow struct {
	Username     string
	FullName     string
	Email        string
	Role         string
	Organization string
	LabQuota     sql.NullInt32
}

type GetAdminUsersRow

type GetAdminUsersRow struct {
	Username     string
	FullName     string
	Email        string
	Role         string
	Organization string
	LabQuota     sql.NullInt32
}

type GetEventSolvesRow

type GetEventSolvesRow struct {
	Tag      string
	SolvedAt time.Time
	Username string
}

type GetExercisesInProfileRow

type GetExercisesInProfileRow struct {
	ID   int32
	Tag  string
	Name string
}

type GetOrgEventsByCreatedByParams

type GetOrgEventsByCreatedByParams struct {
	Organization string
	Createdby    string
}

type GetOrgEventsByStatusAndCreatedByParams

type GetOrgEventsByStatusAndCreatedByParams struct {
	Organization string
	Status       int32
	Createdby    string
}

type GetOrgEventsByStatusParams

type GetOrgEventsByStatusParams struct {
	Organization string
	Status       int32
}

type GetProfileByNameAndOrgNameParams

type GetProfileByNameAndOrgNameParams struct {
	Profilename string
	Orgname     string
}

type GetSolvesForEventRow

type GetSolvesForEventRow struct {
	Tag      string
	Date     time.Time
	Username string
}

type GetTeamFromEventByUsernameNoPwParams

type GetTeamFromEventByUsernameNoPwParams struct {
	Username string
	Eventid  int32
}

type GetTeamFromEventByUsernameParams

type GetTeamFromEventByUsernameParams struct {
	Username string
	Eventid  int32
}

type InsertNewAgentParams

type InsertNewAgentParams struct {
	Name    string
	Url     string
	Weight  int32
	Signkey string
	Authkey string
	Tls     bool
}

type Organization

type Organization struct {
	ID         int32
	Name       string
	OwnerUser  string
	OwnerEmail string
	LabQuota   sql.NullInt32
}

type Profile

type Profile struct {
	ID           int32
	Name         string
	Secret       bool
	Description  string
	Public       bool
	Organization string
}

type ProfileChallenge

type ProfileChallenge struct {
	ID        int32
	Tag       string
	Name      string
	ProfileID int32
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddEvent

func (q *Queries) AddEvent(ctx context.Context, arg AddEventParams) (int32, error)

func (*Queries) AddOrganization

func (q *Queries) AddOrganization(ctx context.Context, arg AddOrganizationParams) error

func (*Queries) AddProfile

func (q *Queries) AddProfile(ctx context.Context, arg AddProfileParams) (int32, error)

func (*Queries) AddProfileChallenge

func (q *Queries) AddProfileChallenge(ctx context.Context, arg AddProfileChallengeParams) error

func (*Queries) AddSolveForTeamInEvent

func (q *Queries) AddSolveForTeamInEvent(ctx context.Context, arg AddSolveForTeamInEventParams) error

func (*Queries) AddTeam

func (q *Queries) AddTeam(ctx context.Context, arg AddTeamParams) error

func (*Queries) CheckIfAgentExists

func (q *Queries) CheckIfAgentExists(ctx context.Context, agentname string) (bool, error)

func (*Queries) CheckIfEventExist

func (q *Queries) CheckIfEventExist(ctx context.Context, tag string) (bool, error)

func (*Queries) CheckIfOrgExists

func (q *Queries) CheckIfOrgExists(ctx context.Context, orgname string) (bool, error)

func (*Queries) CheckIfProfileExists

func (q *Queries) CheckIfProfileExists(ctx context.Context, arg CheckIfProfileExistsParams) (bool, error)

func (*Queries) CheckIfTeamExistsForEvent

func (q *Queries) CheckIfTeamExistsForEvent(ctx context.Context, arg CheckIfTeamExistsForEventParams) (bool, error)

func (*Queries) CheckIfUserExists

func (q *Queries) CheckIfUserExists(ctx context.Context, username string) (bool, error)

func (*Queries) CheckIfUserExistsInOrg

func (q *Queries) CheckIfUserExistsInOrg(ctx context.Context, arg CheckIfUserExistsInOrgParams) (bool, error)

func (*Queries) CheckIfUserOwnsOrg

func (q *Queries) CheckIfUserOwnsOrg(ctx context.Context, ownerusername string) (bool, error)

func (*Queries) CloseEvent

func (q *Queries) CloseEvent(ctx context.Context, arg CloseEventParams) error

func (*Queries) CreateAdminUser

func (q *Queries) CreateAdminUser(ctx context.Context, arg CreateAdminUserParams) error

func (*Queries) DeleteAdminUserByUsername

func (q *Queries) DeleteAdminUserByUsername(ctx context.Context, lower string) error

func (*Queries) DeleteAgentByName

func (q *Queries) DeleteAgentByName(ctx context.Context, name string) error

func (*Queries) DeleteEventById added in v1.0.0

func (q *Queries) DeleteEventById(ctx context.Context, id int32) error

func (*Queries) DeleteEventByTag

func (q *Queries) DeleteEventByTag(ctx context.Context, tag string) error

func (*Queries) DeleteEventOlderThan

func (q *Queries) DeleteEventOlderThan(ctx context.Context, arg DeleteEventOlderThanParams) error

func (*Queries) DeleteOrganization

func (q *Queries) DeleteOrganization(ctx context.Context, orgname string) error

func (*Queries) DeleteProfileById added in v1.0.0

func (q *Queries) DeleteProfileById(ctx context.Context, profileid int32) error

func (*Queries) DeleteProfileByName added in v1.0.0

func (q *Queries) DeleteProfileByName(ctx context.Context, arg DeleteProfileByNameParams) error

func (*Queries) DeleteProfileChallenges added in v1.0.0

func (q *Queries) DeleteProfileChallenges(ctx context.Context, profileid int32) error

func (*Queries) DeleteTeam

func (q *Queries) DeleteTeam(ctx context.Context, arg DeleteTeamParams) error

func (*Queries) GetAdminUserBySid added in v1.0.0

func (q *Queries) GetAdminUserBySid(ctx context.Context, sid string) (AdminUser, error)

func (*Queries) GetAdminUserByUsername

func (q *Queries) GetAdminUserByUsername(ctx context.Context, username string) (AdminUser, error)

func (*Queries) GetAdminUserNoPwByUsername

func (q *Queries) GetAdminUserNoPwByUsername(ctx context.Context, lower string) (GetAdminUserNoPwByUsernameRow, error)

func (*Queries) GetAdminUsers

func (q *Queries) GetAdminUsers(ctx context.Context, organization interface{}) ([]GetAdminUsersRow, error)

func (*Queries) GetAgentByName

func (q *Queries) GetAgentByName(ctx context.Context, name string) (Agent, error)

func (*Queries) GetAgents

func (q *Queries) GetAgents(ctx context.Context) ([]Agent, error)

func (*Queries) GetAllEvents

func (q *Queries) GetAllEvents(ctx context.Context) ([]Event, error)

func (*Queries) GetAllProfilesInOrg

func (q *Queries) GetAllProfilesInOrg(ctx context.Context, orgname string) ([]Profile, error)

func (*Queries) GetAllPublicProfiles added in v1.0.0

func (q *Queries) GetAllPublicProfiles(ctx context.Context) ([]Profile, error)

func (*Queries) GetEventByTag

func (q *Queries) GetEventByTag(ctx context.Context, tag string) (Event, error)

func (*Queries) GetEventSolves

func (q *Queries) GetEventSolves(ctx context.Context, eventID int32) ([]GetEventSolvesRow, error)

func (*Queries) GetEventSolvesMap

func (q *Queries) GetEventSolvesMap(ctx context.Context, eventId int32) (map[string][]GetSolvesForEventRow, error)

func (*Queries) GetEventStatusByTag

func (q *Queries) GetEventStatusByTag(ctx context.Context, tag string) ([]int32, error)

func (*Queries) GetEventsByStatus

func (q *Queries) GetEventsByStatus(ctx context.Context, status int32) ([]Event, error)

func (*Queries) GetEventsByUser

func (q *Queries) GetEventsByUser(ctx context.Context, createdby string) ([]Event, error)

func (*Queries) GetEventsExeptClosed

func (q *Queries) GetEventsExeptClosed(ctx context.Context) ([]Event, error)

func (*Queries) GetExercisesInProfile

func (q *Queries) GetExercisesInProfile(ctx context.Context, profileid int32) ([]GetExercisesInProfileRow, error)

func (*Queries) GetExpectedFinishDate

func (q *Queries) GetExpectedFinishDate(ctx context.Context, tag string) (time.Time, error)

func (*Queries) GetNonSecretProfilesInOrg

func (q *Queries) GetNonSecretProfilesInOrg(ctx context.Context, orgname string) ([]Profile, error)

func (*Queries) GetNonSecretPublicProfiles added in v1.0.0

func (q *Queries) GetNonSecretPublicProfiles(ctx context.Context) ([]Profile, error)

func (*Queries) GetOrgByName

func (q *Queries) GetOrgByName(ctx context.Context, orgname string) (Organization, error)

func (*Queries) GetOrgEvents

func (q *Queries) GetOrgEvents(ctx context.Context, organization string) ([]Event, error)

func (*Queries) GetOrgEventsByCreatedBy

func (q *Queries) GetOrgEventsByCreatedBy(ctx context.Context, arg GetOrgEventsByCreatedByParams) ([]Event, error)

func (*Queries) GetOrgEventsByStatus

func (q *Queries) GetOrgEventsByStatus(ctx context.Context, arg GetOrgEventsByStatusParams) ([]Event, error)

func (*Queries) GetOrgEventsByStatusAndCreatedBy

func (q *Queries) GetOrgEventsByStatusAndCreatedBy(ctx context.Context, arg GetOrgEventsByStatusAndCreatedByParams) ([]Event, error)

func (*Queries) GetOrganizations

func (q *Queries) GetOrganizations(ctx context.Context) ([]Organization, error)

func (*Queries) GetProfileById added in v1.0.0

func (q *Queries) GetProfileById(ctx context.Context, id int32) (Profile, error)

func (*Queries) GetProfileByNameAndOrgName

func (q *Queries) GetProfileByNameAndOrgName(ctx context.Context, arg GetProfileByNameAndOrgNameParams) (Profile, error)

func (*Queries) GetProfiles

func (q *Queries) GetProfiles(ctx context.Context) ([]Profile, error)

func (*Queries) GetTeamCount

func (q *Queries) GetTeamCount(ctx context.Context, eventID int32) (int64, error)

func (*Queries) GetTeamFromEventByUsername

func (q *Queries) GetTeamFromEventByUsername(ctx context.Context, arg GetTeamFromEventByUsernameParams) (Team, error)

func (*Queries) GetTeamFromEventByUsernameNoPw

func (q *Queries) GetTeamFromEventByUsernameNoPw(ctx context.Context, arg GetTeamFromEventByUsernameNoPwParams) (interface{}, error)

func (*Queries) GetTeamSolvesMap

func (q *Queries) GetTeamSolvesMap(ctx context.Context, teamid int32) (map[string]bool, error)

func (*Queries) GetTeamsForEvent

func (q *Queries) GetTeamsForEvent(ctx context.Context, eventID int32) ([]Team, error)

func (*Queries) InsertNewAgent

func (q *Queries) InsertNewAgent(ctx context.Context, arg InsertNewAgentParams) error

func (*Queries) UpdateAdminEmail

func (q *Queries) UpdateAdminEmail(ctx context.Context, arg UpdateAdminEmailParams) error

func (*Queries) UpdateAdminLabQuota added in v1.0.0

func (q *Queries) UpdateAdminLabQuota(ctx context.Context, arg UpdateAdminLabQuotaParams) error

func (*Queries) UpdateAdminPassword

func (q *Queries) UpdateAdminPassword(ctx context.Context, arg UpdateAdminPasswordParams) error

func (*Queries) UpdateEventStatus

func (q *Queries) UpdateEventStatus(ctx context.Context, arg UpdateEventStatusParams) error

func (*Queries) UpdateExercises

func (q *Queries) UpdateExercises(ctx context.Context, arg UpdateExercisesParams) error

UPDATE event SET exercises = (SELECT (SELECT exercises FROM event WHERE id = $1) || $2) WHERE id=$1;

func (*Queries) UpdateOrganization

func (q *Queries) UpdateOrganization(ctx context.Context, arg UpdateOrganizationParams) error

func (*Queries) UpdateProfile added in v1.0.0

func (q *Queries) UpdateProfile(ctx context.Context, arg UpdateProfileParams) error

func (*Queries) UpdateTeamPassword

func (q *Queries) UpdateTeamPassword(ctx context.Context, arg UpdateTeamPasswordParams) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Solf

type Solf struct {
	ID       int32
	Tag      string
	EventID  int32
	TeamID   int32
	SolvedAt time.Time
}

type Team

type Team struct {
	ID         int32
	Tag        string
	EventID    int32
	Email      string
	Username   string
	Password   string
	CreatedAt  time.Time
	LastAccess sql.NullTime
}

type UpdateAdminEmailParams

type UpdateAdminEmailParams struct {
	Email    string
	Username string
}

type UpdateAdminLabQuotaParams added in v1.0.0

type UpdateAdminLabQuotaParams struct {
	Labquota sql.NullInt32
	Username string
}

type UpdateAdminPasswordParams

type UpdateAdminPasswordParams struct {
	Password string
	Username string
}

type UpdateEventStatusParams

type UpdateEventStatusParams struct {
	Tag    string
	Status int32
}

type UpdateExercisesParams

type UpdateExercisesParams struct {
	Tag        string
	LastAccess sql.NullTime
}

type UpdateOrganizationParams

type UpdateOrganizationParams struct {
	Ownerusername string
	Owneremail    string
	Labquota      sql.NullInt32
	Orgname       string
}

type UpdateProfileParams added in v1.0.0

type UpdateProfileParams struct {
	Profilename string
	Secret      bool
	Orgname     string
	Description string
	Public      bool
	ID          int32
}

type UpdateTeamPasswordParams

type UpdateTeamPasswordParams struct {
	Password string
	Tag      string
	EventID  int32
}

Jump to

Keyboard shortcuts

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