Documentation ¶
Index ¶
- Constants
- Variables
- func InitializeDB(logger *zap.Logger, databaseConfig configs.Database) (*gorm.DB, error)
- type Account
- type AccountDataAccessor
- type AccountPassword
- type AccountPasswordDataAccessor
- type AccountRole
- type Migrator
- type Problem
- type ProblemDataAccessor
- type ProblemExample
- type ProblemExampleDataAccessor
- type ProblemTestCaseHash
- type ProblemTestCaseHashDataAccessor
- type Setting
- type SettingDataAccessor
- type Submission
- type SubmissionDataAccessor
- type SubmissionListFilterParams
- type SubmissionResult
- type SubmissionStatus
- type TestCase
- type TestCaseDataAccessor
- type TokenPublicKey
- type TokenPublicKeyDataAccessor
Constants ¶
View Source
const ( SubmissionStatusSubmitted SubmissionStatus = 1 SubmissionStatusExecuting SubmissionStatus = 2 SubmissionStatusFinished SubmissionStatus = 3 SubmissionResultOK SubmissionResult = 1 SubmissionResultCompileError SubmissionResult = 2 SubmissionResultRuntimeError SubmissionResult = 3 SubmissionResultTimeLimitExceeded SubmissionResult = 4 SubmissionResultMemoryLimitExceeded SubmissionResult = 5 SubmissionResultWrongAnswer SubmissionResult = 6 SubmissionResultUnsupportedLanguage SubmissionResult = 7 )
Variables ¶
View Source
var WireSet = wire.NewSet( InitializeDB, NewTokenPublicKeyDataAccessor, NewMigrator, NewAccountDataAccessor, NewAccountPasswordDataAccessor, NewProblemDataAccessor, NewProblemExampleDataAccessor, NewTestCaseDataAccessor, NewProblemTestCaseHashDataAccessor, NewSubmissionDataAccessor, NewSettingDataAccessor, )
Functions ¶
Types ¶
type Account ¶
type Account struct { gorm.Model AccountName string `gorm:"type:varchar(32);uniqueIndex"` DisplayName string `gorm:"type:varchar(32)"` Role AccountRole `gorm:"type:varchar(32)"` }
type AccountDataAccessor ¶
type AccountDataAccessor interface { CreateAccount(ctx context.Context, account *Account) error UpdateAccount(ctx context.Context, account *Account) error GetAccount(ctx context.Context, id uint64) (*Account, error) GetAccountByAccountName(ctx context.Context, accountName string) (*Account, error) GetAccountList(ctx context.Context, offset, limit uint64) ([]*Account, error) GetAccountCount(ctx context.Context) (uint64, error) WithDB(db *gorm.DB) AccountDataAccessor }
func NewAccountDataAccessor ¶
func NewAccountDataAccessor( db *gorm.DB, logger *zap.Logger, ) AccountDataAccessor
type AccountPassword ¶
type AccountPasswordDataAccessor ¶
type AccountPasswordDataAccessor interface { CreateAccountPassword(ctx context.Context, accountPassword *AccountPassword) error UpdateAccountPassword(ctx context.Context, accountPassword *AccountPassword) error GetAccountPasswordOfAccountID(ctx context.Context, accountID uint64) (*AccountPassword, error) WithDB(db *gorm.DB) AccountPasswordDataAccessor }
func NewAccountPasswordDataAccessor ¶
func NewAccountPasswordDataAccessor( db *gorm.DB, logger *zap.Logger, ) AccountPasswordDataAccessor
type AccountRole ¶
type AccountRole string
const ( AccountRoleAdmin AccountRole = "admin" AccountRoleProblemSetter AccountRole = "problem_setter" AccountRoleContestant AccountRole = "contestant" AccountRoleWorker AccountRole = "worker" )
type ProblemDataAccessor ¶
type ProblemDataAccessor interface { CreateProblem(ctx context.Context, problem *Problem) error UpdateProblem(ctx context.Context, problem *Problem) error DeleteProblem(ctx context.Context, id uint64) error GetProblem(ctx context.Context, id uint64) (*Problem, error) GetProblemByUUID(ctx context.Context, uuid string) (*Problem, error) GetProblemList(ctx context.Context, offset, limit uint64) ([]*Problem, error) GetAccountProblemList(ctx context.Context, accountID uint64, offset, limit uint64) ([]*Problem, error) GetProblemCount(ctx context.Context) (uint64, error) GetAccountProblemCount(ctx context.Context, accountID uint64) (uint64, error) WithDB(db *gorm.DB) ProblemDataAccessor }
func NewProblemDataAccessor ¶
func NewProblemDataAccessor( db *gorm.DB, logger *zap.Logger, ) ProblemDataAccessor
type ProblemExample ¶
type ProblemExampleDataAccessor ¶
type ProblemExampleDataAccessor interface { CreateProblemExampleList(ctx context.Context, problemExampleList []*ProblemExample) error GetProblemExampleListOfProblem(ctx context.Context, problemID uint64) ([]*ProblemExample, error) DeleteProblemExampleOfProblem(ctx context.Context, problemID uint64) error WithDB(db *gorm.DB) ProblemExampleDataAccessor }
func NewProblemExampleDataAccessor ¶
func NewProblemExampleDataAccessor( db *gorm.DB, logger *zap.Logger, ) ProblemExampleDataAccessor
type ProblemTestCaseHash ¶
type ProblemTestCaseHashDataAccessor ¶
type ProblemTestCaseHashDataAccessor interface { CreateProblemTestCaseHash(ctx context.Context, problemTestCaseHash *ProblemTestCaseHash) error UpdateProblemTestCaseHash(ctx context.Context, problemTestCaseHash *ProblemTestCaseHash) error GetProblemTestCaseHashOfProblem(ctx context.Context, problemID uint64) (*ProblemTestCaseHash, error) DeleteProblemTestCaseHashOfProblem(ctx context.Context, problemID uint64) error WithDB(db *gorm.DB) ProblemTestCaseHashDataAccessor }
func NewProblemTestCaseHashDataAccessor ¶
func NewProblemTestCaseHashDataAccessor( db *gorm.DB, logger *zap.Logger, ) ProblemTestCaseHashDataAccessor
type SettingDataAccessor ¶ added in v1.2.0
type SettingDataAccessor interface { UpsertSetting(ctx context.Context, setting *Setting) error GetSetting(ctx context.Context) (*Setting, error) WithDB(db *gorm.DB) SettingDataAccessor }
func NewSettingDataAccessor ¶ added in v1.2.0
func NewSettingDataAccessor( db *gorm.DB, logger *zap.Logger, ) SettingDataAccessor
type Submission ¶
type Submission struct { gorm.Model OfProblemID uint64 `gorm:"index"` AuthorAccountID uint64 `gorm:"index"` Content string `gorm:"type:text"` Language string `gorm:"type:varchar(16)"` Status SubmissionStatus `gorm:"index"` Result SubmissionResult }
type SubmissionDataAccessor ¶
type SubmissionDataAccessor interface { CreateSubmission(ctx context.Context, submission *Submission) error UpdateSubmission(ctx context.Context, submission *Submission) error UpdateExecutingSubmissionUpdatedBeforeThresholdToSubmitted(ctx context.Context, threshold time.Time) error DeleteSubmission(ctx context.Context, id uint64) error DeleteSubmissionOfProblem(ctx context.Context, problemID uint64) error GetSubmission(ctx context.Context, id uint64) (*Submission, error) GetSubmissionList( ctx context.Context, filterParams SubmissionListFilterParams, offset, limit uint64, ) ([]*Submission, error) GetSubmissionIDList(ctx context.Context, filterParams SubmissionListFilterParams) ([]uint64, error) GetSubmissionCount(ctx context.Context, filterParams SubmissionListFilterParams) (uint64, error) WithDB(db *gorm.DB) SubmissionDataAccessor }
func NewSubmissionDataAccessor ¶
func NewSubmissionDataAccessor( db *gorm.DB, logger *zap.Logger, ) SubmissionDataAccessor
type SubmissionListFilterParams ¶
type SubmissionListFilterParams struct { OfProblemID *uint64 AuthorAccountID *uint64 Status SubmissionStatus }
type SubmissionResult ¶
type SubmissionResult uint8
type SubmissionStatus ¶
type SubmissionStatus uint8
type TestCaseDataAccessor ¶
type TestCaseDataAccessor interface { CreateTestCase(ctx context.Context, testCase *TestCase) error CreateTestCaseList(ctx context.Context, testCaseList []*TestCase) error GetTestCase(ctx context.Context, id uint64) (*TestCase, error) GetTestCaseByUUID(ctx context.Context, uuid string) (*TestCase, error) GetTestCaseListOfProblem(ctx context.Context, problemID uint64, offset uint64, limit uint64) ([]*TestCase, error) GetTestCaseIDListOfProblem(ctx context.Context, problemID uint64) ([]uint64, error) GetTestCaseHashListOfProblem(ctx context.Context, problemID uint64, offset uint64, limit uint64) ([]string, error) GetTestCaseCountOfProblem(ctx context.Context, problemID uint64) (uint64, error) UpdateTestCase(ctx context.Context, testCase *TestCase) error DeleteTestCase(ctx context.Context, id uint64) error DeleteTestCaseOfProblem(ctx context.Context, problemID uint64) error WithDB(db *gorm.DB) TestCaseDataAccessor }
func NewTestCaseDataAccessor ¶
func NewTestCaseDataAccessor( db *gorm.DB, logger *zap.Logger, ) TestCaseDataAccessor
type TokenPublicKey ¶ added in v1.1.0
type TokenPublicKeyDataAccessor ¶ added in v1.1.0
type TokenPublicKeyDataAccessor interface { CreatePublicKey(ctx context.Context, tokenPublicKey *TokenPublicKey) error GetPublicKey(ctx context.Context, id uint64) (*TokenPublicKey, error) WithDB(db *gorm.DB) TokenPublicKeyDataAccessor }
func NewTokenPublicKeyDataAccessor ¶ added in v1.1.0
func NewTokenPublicKeyDataAccessor( db *gorm.DB, logger *zap.Logger, ) TokenPublicKeyDataAccessor
Click to show internal directories.
Click to hide internal directories.