store

package
v0.0.0-...-9b92ec5 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSolution

func AddSolution(solution Solution) error

AddSolution 添加解题答案

func AllQuestionTitleSlug

func AllQuestionTitleSlug() (titles []string, err error)

func MarkQuestion

func MarkQuestion(question Question) error

func MarkSolution

func MarkSolution(solution markSolution) error

func NewMarkSolution

func NewMarkSolution(remark string, s Solution) markSolution

func ProblemInfoIsExpire

func ProblemInfoIsExpire() (ok bool, err error)

func ProblemsTTL

func ProblemsTTL(expireAt time.Time) error

func RemoveSolution

func RemoveSolution(questionID string) error

RemoveSolution delete solution

func Stats

func Stats()

Stats leetcode db stats

func TidySolution

func TidySolution(questionID string) error

func UpdateProblems

func UpdateProblems(info []QuestionStats) error

func UpdateQuestionInfo

func UpdateQuestionInfo(store Store) error

Types

type MarkSolutions

type MarkSolutions []markSolution

func ListMarkSolutions

func ListMarkSolutions() (ss MarkSolutions, err error)

func (*MarkSolutions) Add

func (th *MarkSolutions) Add(ms markSolution)

func (MarkSolutions) Bytes

func (th MarkSolutions) Bytes() []byte

func (MarkSolutions) Len

func (th MarkSolutions) Len() int

func (MarkSolutions) Less

func (th MarkSolutions) Less(i, j int) bool

func (MarkSolutions) Swap

func (th MarkSolutions) Swap(i, j int)

type Question

type Question struct {
	QuestionID string    `json:"question_id"`
	Title      string    `json:"title"`
	Remark     string    `json:"remark"`
	CreatedAt  time.Time `json:"created_at"`
}

Question 问题描述

func NewMarkQuestion

func NewMarkQuestion(questionID, title, remark string) Question

NewMarkQuestion 问题书签

type QuestionStats

type QuestionStats struct {
	QuestionID          int    `json:"question_id"`
	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"`
	TotalColumnArticles int    `json:"total_column_articles"`
	FrontendQuestionID  string `json:"frontend_question_id"`
	IsNewQuestion       bool   `json:"is_new_question"`
}

func GetProblemsInfo

func GetProblemsInfo(questionID string) (info QuestionStats, err error)

func (*QuestionStats) Bytes

func (th *QuestionStats) Bytes() []byte

type Questions

type Questions []Question

func ListMarkQuestions

func ListMarkQuestions() (qs Questions, err error)

func (*Questions) Add

func (th *Questions) Add(q Question)

func (Questions) Bytes

func (th Questions) Bytes() []byte

func (Questions) Len

func (th Questions) Len() int

func (Questions) Less

func (th Questions) Less(i, j int) bool

func (Questions) Swap

func (th Questions) Swap(i, j int)

type Solution

type Solution struct {
	QuestionID  string        `json:"question_id"` // 问题id
	Language    string        `json:"language"`    // 语言
	CodeHash    string        `json:"code_hash"`   // 实现代码格式化后的hash
	SourceDir   string        `json:"source_dir"`  // 代码存放目录
	Code        string        `json:"code"`        // 实现的代码
	Result      string        `json:"result"`      // 测试返回结果
	Times       int           `json:"times"`       // 执行次数
	Consumption time.Duration `json:"consumption"` // 消耗
	Evaluation  string        `json:"evaluation"`  // 运行评价
	Remark      string        `json:"remark"`      // 备注
	CreatedAt   time.Time     `json:"create_at"`   // 创建内容时间
}

Solution 解题内容

func GetSolution

func GetSolution(questionID string) (ss []Solution, err error)

GetSolution 获取测试过的题解

func NewSolution

func NewSolution(questionID, lang, sourceDir, code, result, evaluation, remark string, consumption time.Duration) Solution

NewSolution 创建题解

type SolutionsList

type SolutionsList struct {
	QuestionID string    `json:"question_id"`
	Version    int       `json:"version"`
	Times      int       `json:"times"` // 执行次数
	FirstTime  time.Time `json:"first_time"`
	LastTime   time.Time `json:"last_time"`
}

func ListSolution

func ListSolution() (sl []SolutionsList, err error)

type Store

type Store struct {
	Title           string   `json:"title"`
	TranslatedTitle string   `json:"translated_title"`
	QuestionID      string   `json:"question_id"`
	Languages       []string `json:"language"`
	Tags            []string `json:"tags"`

	Difficulty string   `json:"difficulty"`
	SaveDir    []string `json:"save_dir"`
	TitleSlug  string   `json:"title_slug"`
	Question   string   `json:"question"`
}

func QuestionInfo

func QuestionInfo(titleSlug string) (info Store, err error)

func (Store) Bytes

func (th Store) Bytes() []byte

Jump to

Keyboard shortcuts

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