Documentation ¶
Index ¶
Constants ¶
View Source
const ( App = "leet" ConfigFile = "leet.yaml" QuestionFile = "question.json" )
应用
View Source
const ( SymbolError = "💣" SymbolNotice = "🐶" SymbolSuccess = "🎉" SymbolTime = "🕙" )
符号
View Source
const ( LeetCodeAllURL = "https://leetcode-cn.com/api/problems/all/" // 题目列表地址 LeetCodeTagURL = "https://leetcode-cn.com/tag/%s/problemset/" // 标签页面地址 LeetCodeGraphqlURL = "https://leetcode-cn.com/graphql" // 题目数据地址 LeetCodeQuestionURL = "https://leetcode-cn.com/problems/%s/" // 题目页面地址 )
LeetCode 接口地址
View Source
const ( QuestionPath = "question" CategoryPath = "category" )
文件地址配置
Variables ¶
View Source
var ( LangExt = map[string]string{ "golang": "go", "php": "php", "python": "py", "python3": "py", "javascript": "js", "mysql": "sql", "bash": "sh", } LangList = []string{ "golang", "php", "python", "python3", "javascript", "mysql", "bash", } LangMap = map[string]map[string]string{ "golang": { "file": "solution.go", "fileTpl": "package solution\n\n%s", "testfile": "solution_test.go", "testfileTpl": TplQuestionGoTest, }, "javascript": { "file": "solution.js", "fileTpl": "%s\n\nmodule.exports = FuncToReplace;", "testfile": "solution.test.js", "testfileTpl": TplQuestionJsTest, }, } LangFile = "solution.%s" LangFileTpl = "%s" )
答题语言配置
View Source
var TplQuestionGoTest string
TplQuestionGoTest ...
View Source
var TplQuestionJsTest string
TplQuestionJsTest ...
View Source
var TplQuestionReadme string
TplQuestionReadme ...
View Source
var TplRecord string
TplRecord ...
View Source
var TplTag string
TplTag ...
Functions ¶
This section is empty.
Types ¶
type Question ¶
type Question struct { Fid string `json:"fid"` // 显示 id Qid int64 `json:"qid"` // 实际 id Title string `json:"title"` // 名称 Slug string `json:"slug"` // 标识 Link string `json:"link"` // 链接 Level QuestionLevel `json:"level"` // 困难度 Detail *QuestionDetail `json:"detail"` // 详情 }
Question ...
type QuestionDetail ¶
type QuestionDetail struct { Title string `json:"title"` Content string `json:"content"` TagList []Tag `json:"tag_list"` TagSlugList []string `json:"tag_slug_list"` LangList []string `json:"lang_list"` CodeMap map[string]string `json:"code_map"` }
QuestionDetail ...
type QuestionLevel ¶
type QuestionLevel int
QuestionLevel 题目难度
const ( QuestionLevelEasy QuestionLevel = iota + 1 QuestionLevelMiddle QuestionLevelHard )
...
type QuestionTag ¶
type QuestionTag struct { Slug string `json:"titleSlug"` TopicTags []struct { Slug string `json:"slug"` } `json:"topicTags"` }
QuestionTag ...
Click to show internal directories.
Click to hide internal directories.