Documentation ¶
Index ¶
- type AccountContext
- type AccountManager
- type BuildStandingsOptions
- type ContestContext
- func (c *ContestContext) GetEffectiveParticipant() *models.ContestParticipant
- func (c *ContestContext) GetEffectivePermissions() PermissionSet
- func (c *ContestContext) HasEffectivePermission(name string) bool
- func (c *ContestContext) HasPermission(name string) bool
- func (c *ContestContext) SetEffectiveParticipant(id int64)
- type ContestManager
- type ContestStage
- type ContestStandings
- type ContestStandingsCell
- type ContestStandingsColumn
- type ContestStandingsManager
- type ContestStandingsRow
- type FileManager
- func (m *FileManager) ConfirmUploadFile(ctx context.Context, file *models.File) error
- func (m *FileManager) DeleteFile(ctx context.Context, id int64) error
- func (m *FileManager) DownloadFile(ctx context.Context, id int64) (io.ReadCloser, error)
- func (m *FileManager) UploadFile(ctx context.Context, fileReader *FileReader) (models.File, error)
- type FileReader
- type FileStorage
- type LocalStorage
- func (s *LocalStorage) DeleteFile(ctx context.Context, filePath string) error
- func (s *LocalStorage) GeneratePath(ctx context.Context) (string, error)
- func (s *LocalStorage) ReadFile(ctx context.Context, filePath string) (io.ReadCloser, error)
- func (s *LocalStorage) WriteFile(ctx context.Context, filePath string, file io.ReadSeeker) (models.FileMeta, error)
- type PermissionSet
- type Permissions
- type S3Storage
- func (s *S3Storage) DeleteFile(ctx context.Context, filePath string) error
- func (s *S3Storage) GeneratePath(ctx context.Context) (string, error)
- func (s *S3Storage) ReadFile(ctx context.Context, filePath string) (io.ReadCloser, error)
- func (s *S3Storage) WriteFile(ctx context.Context, filePath string, file io.ReadSeeker) (models.FileMeta, error)
- type SolutionManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountContext ¶
type AccountContext struct { Account *models.Account User *models.User ScopeUser *models.ScopeUser Permissions PermissionSet GroupAccounts []models.Account // contains filtered or unexported fields }
func (*AccountContext) Done ¶
func (c *AccountContext) Done() <-chan struct{}
func (*AccountContext) Err ¶
func (c *AccountContext) Err() error
func (*AccountContext) HasPermission ¶
func (c *AccountContext) HasPermission(name string) bool
func (*AccountContext) Value ¶
func (c *AccountContext) Value(key any) any
type AccountManager ¶
type AccountManager struct {
// contains filtered or unexported fields
}
func NewAccountManager ¶
func NewAccountManager(core *core.Core) *AccountManager
func (*AccountManager) MakeContext ¶
func (m *AccountManager) MakeContext(ctx context.Context, account *models.Account) (*AccountContext, error)
type BuildStandingsOptions ¶
type ContestContext ¶
type ContestContext struct { *AccountContext Contest models.Contest ContestConfig models.ContestConfig Participants []models.ContestParticipant Permissions PermissionSet Stage ContestStage Now time.Time // contains filtered or unexported fields }
func (*ContestContext) GetEffectiveParticipant ¶
func (c *ContestContext) GetEffectiveParticipant() *models.ContestParticipant
func (*ContestContext) GetEffectivePermissions ¶
func (c *ContestContext) GetEffectivePermissions() PermissionSet
func (*ContestContext) HasEffectivePermission ¶
func (c *ContestContext) HasEffectivePermission(name string) bool
func (*ContestContext) HasPermission ¶
func (c *ContestContext) HasPermission(name string) bool
func (*ContestContext) SetEffectiveParticipant ¶
func (c *ContestContext) SetEffectiveParticipant(id int64)
type ContestManager ¶
type ContestManager struct {
// contains filtered or unexported fields
}
func NewContestManager ¶
func NewContestManager(core *core.Core) *ContestManager
func (*ContestManager) BuildContext ¶
func (m *ContestManager) BuildContext(ctx *AccountContext, contest models.Contest) (*ContestContext, error)
type ContestStage ¶
type ContestStage int
const ( ContestNotPlanned ContestStage = iota ContestNotStarted ContestStarted ContestFinished )
type ContestStandings ¶
type ContestStandings struct { Columns []ContestStandingsColumn Rows []ContestStandingsRow Frozen bool }
type ContestStandingsCell ¶
type ContestStandingsColumn ¶
type ContestStandingsColumn struct { Problem models.ContestProblem TotalSolutions int AcceptedSolutions int }
type ContestStandingsManager ¶
type ContestStandingsManager struct {
// contains filtered or unexported fields
}
func NewContestStandingsManager ¶
func NewContestStandingsManager(core *core.Core) *ContestStandingsManager
func (*ContestStandingsManager) BuildStandings ¶
func (m *ContestStandingsManager) BuildStandings( ctx *ContestContext, options BuildStandingsOptions, ) (*ContestStandings, error)
type ContestStandingsRow ¶
type ContestStandingsRow struct { Participant models.ContestParticipant Cells []ContestStandingsCell Score float64 Penalty *int64 Place int }
type FileManager ¶
type FileManager struct {
// contains filtered or unexported fields
}
func NewFileManager ¶
func NewFileManager(c *core.Core) *FileManager
func (*FileManager) ConfirmUploadFile ¶
func (*FileManager) DeleteFile ¶
func (m *FileManager) DeleteFile(ctx context.Context, id int64) error
func (*FileManager) DownloadFile ¶
func (m *FileManager) DownloadFile( ctx context.Context, id int64, ) (io.ReadCloser, error)
func (*FileManager) UploadFile ¶
func (m *FileManager) UploadFile( ctx context.Context, fileReader *FileReader, ) (models.File, error)
UploadFile adds file to file storage and starts upload.
You shold call ConfirmUploadFile for marking file available.
type FileReader ¶
type FileReader struct { Name string Size int64 Reader io.ReadSeeker }
func NewFileReader ¶
func NewFileReader(file *os.File) *FileReader
func NewMultipartFileReader ¶
func NewMultipartFileReader(file *multipart.FileHeader) (*FileReader, error)
func (*FileReader) Close ¶
func (f *FileReader) Close() error
type FileStorage ¶
type LocalStorage ¶
type LocalStorage struct {
Dir string
}
func (*LocalStorage) DeleteFile ¶
func (s *LocalStorage) DeleteFile(ctx context.Context, filePath string) error
func (*LocalStorage) GeneratePath ¶
func (s *LocalStorage) GeneratePath(ctx context.Context) (string, error)
func (*LocalStorage) ReadFile ¶
func (s *LocalStorage) ReadFile(ctx context.Context, filePath string) (io.ReadCloser, error)
type PermissionSet ¶
type PermissionSet map[string]struct{}
func (PermissionSet) AddPermission ¶
func (p PermissionSet) AddPermission(names ...string)
func (PermissionSet) Clone ¶
func (p PermissionSet) Clone() PermissionSet
func (PermissionSet) HasPermission ¶
func (p PermissionSet) HasPermission(name string) bool
type Permissions ¶
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
func (*S3Storage) DeleteFile ¶
func (*S3Storage) GeneratePath ¶
type SolutionManager ¶
type SolutionManager struct {
// contains filtered or unexported fields
}
func NewSolutionManager ¶
func NewSolutionManager(core *core.Core, files *FileManager) *SolutionManager
Click to show internal directories.
Click to hide internal directories.