Documentation ¶
Index ¶
- Constants
- Variables
- func CreateRecord[T ST](t T) error
- func DeleteRecord[T ST](t T) error
- func DeleteRecordByID[T ST](ID uint) (T, error)
- func GetAllRecords[T ST]() ([]T, error)
- func GetRecordByExp[T ST](query any, args ...any) (T, error)
- func GetRecordByID[T ST](ID string) (T, error)
- func GetRecordByModel[T ST](t T, preloads ...string) error
- func GetUserByUsername(username string, u *User) error
- func GetUserByUsernameOrEmail(username, email string, u *User) error
- func GetVerifyEmailUsingIDToken(id, token string, ve *VerifyEmail) error
- func UpdateRecord[T ST](t T) error
- type CheckerType
- type Contest
- type Dataset
- type Language
- type PermitType
- type Problem
- type ProblemChangeLog
- type ProblemDiscussion
- type ProblemShare
- type ProblemSolution
- type ProblemSpecialChecker
- type ProblemTag
- type ST
- type Session
- type Tag
- type User
- type VerifyEmail
- func (ve *VerifyEmail) ExtractEmail() string
- func (ve *VerifyEmail) FillEmailVerifierInfo(u *User) error
- func (ve *VerifyEmail) GenerateLink() string
- func (ve *VerifyEmail) GenerateToken() error
- func (ve *VerifyEmail) IsLinkExpired() error
- func (ve *VerifyEmail) IsLinkUsed() bool
- func (ve *VerifyEmail) SetExpirationTime()
- func (ve *VerifyEmail) VerifiedUser() *User
Constants ¶
View Source
const ( AdminRole = iota StaffRole UserRole )
Variables ¶
View Source
var SessionCache = cache.NewMemoryCache[Session]()
Functions ¶
func CreateRecord ¶
func DeleteRecord ¶
func DeleteRecordByID ¶
func GetAllRecords ¶
func GetRecordByID ¶
func GetRecordByModel ¶
func GetUserByUsername ¶
func GetVerifyEmailUsingIDToken ¶
func GetVerifyEmailUsingIDToken(id, token string, ve *VerifyEmail) error
func UpdateRecord ¶
Types ¶
type CheckerType ¶
type CheckerType string
const ( Default CheckerType = "Default" String CheckerType = "String" Float CheckerType = "Float" Special CheckerType = "Special" )
type PermitType ¶
type PermitType string
const ( Author PermitType = "Author" Editor PermitType = "Editor" Viewer PermitType = "Viewer" Tester PermitType = "Tester" )
func (PermitType) IsPermitTypeValid ¶
func (t PermitType) IsPermitTypeValid() bool
type Problem ¶
type Problem struct { gorm.Model AuthorID uint Author *User `gorm:"required;foreignKey:AuthorID" json:"-"` ContestID *uint `json:"contestID"` Contest *Contest `json:"contest"` Title string `gorm:"Index;not null;type:varchar(55)"` TimeLimit float64 MemoryLimit float64 Statement string InputStatement string OutputStatement string NoteStatement string StatementsVisibilityDuringContest bool Tags []ProblemTag Datasets []Dataset Solutions []ProblemSolution IsProblemPublishable bool `gorm:"default:false"` IsProblemPublished bool `gorm:"default:false"` CheckerType CheckerType `gorm:"default:Default"` ChangeLogs []ProblemChangeLog Discussions []ProblemDiscussion }
func (*Problem) FindSharedUser ¶
func (p *Problem) FindSharedUser(userID uint) *ProblemShare
func (*Problem) GetSharedUserColumnName ¶
func (*Problem) GetSharedWithColumnName ¶
type ProblemChangeLog ¶
type ProblemDiscussion ¶
type ProblemShare ¶
type ProblemShare struct {}
func (*ProblemShare) CanAddDataset ¶
func (ps *ProblemShare) CanAddDataset() bool
func (*ProblemShare) CanAddSolution ¶
func (ps *ProblemShare) CanAddSolution() bool
type ProblemSolution ¶
type ProblemSpecialChecker ¶
type ProblemTag ¶
type ST ¶
type ST interface { *User | *Session | *Problem | *Contest | *Tag | *VerifyEmail | *ProblemTag | *Dataset | *ProblemShare | *ProblemChangeLog | *ProblemSolution | *ProblemDiscussion }
type User ¶
type User struct { gorm.Model Username string `gorm:"uniqueIndex;not null"` Email string `gorm:"uniqueIndex,omitempty;default:null"` KeepEmailPrivate bool `gorm:"default:1"` Password string `gorm:"not null"` Role uint `gorm:"default:2"` Verified bool `gorm:"default:0"` DisplayName string Organization string Country string City string Image string }
func (*User) CheckPassword ¶
func (*User) ExtractEmail ¶
func (*User) HashPassword ¶
type VerifyEmail ¶
type VerifyEmail struct { gorm.Model Token string `gorm:"uniqueIndex;not null"` Email string `gorm:"not null"` ExpirationTime time.Time IsUsed bool UserId uint User User }
func (*VerifyEmail) ExtractEmail ¶
func (ve *VerifyEmail) ExtractEmail() string
func (*VerifyEmail) FillEmailVerifierInfo ¶
func (ve *VerifyEmail) FillEmailVerifierInfo(u *User) error
func (*VerifyEmail) GenerateLink ¶
func (ve *VerifyEmail) GenerateLink() string
func (*VerifyEmail) GenerateToken ¶
func (ve *VerifyEmail) GenerateToken() error
func (*VerifyEmail) IsLinkExpired ¶
func (ve *VerifyEmail) IsLinkExpired() error
func (*VerifyEmail) IsLinkUsed ¶
func (ve *VerifyEmail) IsLinkUsed() bool
func (*VerifyEmail) SetExpirationTime ¶
func (ve *VerifyEmail) SetExpirationTime()
func (*VerifyEmail) VerifiedUser ¶
func (ve *VerifyEmail) VerifiedUser() *User
Source Files ¶
Click to show internal directories.
Click to hide internal directories.