Documentation
¶
Index ¶
- Variables
- func AddLeetCodeProblem(problem *Problem)
- func ClearTestDatabase()
- func ConnectionDatabase()
- func CountStudyGroupProblems(SID uuid.UUID) int64
- func CreateLeetCodeProblemsTable()
- func CreateNewReport(UserID string, ProblemID int, SID uuid.UUID)
- func DeleteReport(UserID string, ProblemID int, SID uuid.UUID)
- func DeleteUserReports(UserID, GuildID string)
- func GetTodayEnd() int64
- func IsStudyGroupExist(GuildID string) bool
- func SetDB(db *gorm.DB)
- func SetStudyGroupTime(GuildID string, t time.Time) (uuid.UUID, bool)
- func UpdateSgAttendance(SID uuid.UUID) (int, int)
- func VerifyProblem(ProblemID int) bool
- func VerifyReport(UserID string, ProblemID int, SID uuid.UUID) bool
- func VerifyStudyGroup(GuildID string) uuid.UUID
- type LeetCode
- type Problem
- type Report
- type ReportsResult
- type StudyGroup
- type Time
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *gorm.DB
Functions ¶
func AddLeetCodeProblem ¶
func AddLeetCodeProblem(problem *Problem)
func ClearTestDatabase ¶
func ClearTestDatabase()
func CreateLeetCodeProblemsTable ¶
func CreateLeetCodeProblemsTable()
func DeleteUserReports ¶
func DeleteUserReports(UserID, GuildID string)
func UpdateSgAttendance ¶
更新study group 人數狀態並且回傳舉辦時間
func VerifyReport ¶
不存在指定的report return true
func VerifyStudyGroup ¶
if studygroup update, remeber also update new studygroup turn && old studygroup next turn value.
Types ¶
type LeetCode ¶
type LeetCode struct {
UserName string `json:"user_name"`
NumSolved int `json:"num_solved"`
NumTotal int `json:"num_total"`
AcEasy int `json:"ac_easy"`
AcMedium int `json:"ac_medium"`
AcHard int `json:"ac_hard"`
StatStatusPairs []struct {
Stat struct {
QuestionID int `json:"question_id"`
QuestionArticleLive interface{} `json:"question__article__live"` //
QuestionArticleSlug interface{} `json:"question__article__slug"` //
QuestionTitle string `json:"question__title"`
QuestionTitleSlug string `json:"question__title_slug"`
QuestionHide bool `json:"question__hide"`
TotalAcs int `json:"total_acs"`
TotalSubmitted int `json:"total_submitted"`
FrontendQuestionID int `json:"frontend_question_id"`
IsNewQuestion bool `json:"is_new_question"`
} `json:"stat"`
Status interface{} `json:"status"` //
Difficulty struct {
Level int `json:"level"`
} `json:"difficulty"`
PaidOnly bool `json:"paid_only"`
IsFavor bool `json:"is_favor"`
Frequency int `json:"frequency"`
Progress int `json:"progress"`
} `json:"stat_status_pairs"`
}
leetcode api data struct
type Problem ¶
type Problem struct {
ProblemID int `gorm:"primaryKey"`
ProblemTitle string `gorm:"not null"`
ProblemURL string
Difficulty int
PaidOnly bool
Submit int
Accept int
}
func SearchWithProblemID ¶
func SearchWithProblemIDTest ¶
func SearchWithProblemTitle ¶
type ReportsResult ¶
func GetStudyGroupReports ¶
func GetStudyGroupReports(SID uuid.UUID) []ReportsResult
func GetUserReports ¶
func GetUserReports(SID uuid.UUID, UserID string) []ReportsResult
use user_id and s_id search user's reports
type StudyGroup ¶
type StudyGroup struct {
SID uuid.UUID `gorm:"type: char(36); primaryKey; not null; unique;"`
Turn uint16
GuildID string
Attendance uint16
NextTurn bool
StartTime Time `gorm:"not null;"`
}
func GetStudyGroup ¶
func GetStudyGroup(SID uuid.UUID) *StudyGroup
func GetStudyGroupWithGID ¶
func GetStudyGroupWithGID(GuildID string) (*StudyGroup, error)
type Time ¶
func (Time) MarshalJSON ¶
MarshalJSON implements json marshal interface.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements json unmarshal interface.
Click to show internal directories.
Click to hide internal directories.