config

package
v0.0.0-...-4a77b84 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 1 Imported by: 0

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
)

...

func (QuestionLevel) String

func (t QuestionLevel) String() string

String ...

type QuestionTag

type QuestionTag struct {
	Slug      string `json:"titleSlug"`
	TopicTags []struct {
		Slug string `json:"slug"`
	} `json:"topicTags"`
}

QuestionTag ...

type Tag

type Tag struct {
	Name  string `json:"name"`  // 名称
	Slug  string `json:"slug"`  // 标识
	Count int    `json:"count"` // 题目数量
}

Tag ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL