model

package
v0.0.0-...-1e1773c Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type All

type All struct {
	StatStatusPairs []StatStatusPair `json:"stat_status_pairs"`
}

type Code

type Code struct {
	Text        string `json:"text"`
	Value       string `json:"value"`
	DefaultCode string `json:"defaultCode"`
}

Code the struct of leetcode codes.

type Difficulty

type Difficulty struct {
	Level int `json:"level"`
}

func (*Difficulty) String

func (d *Difficulty) String() string

type GetQuestionResponse

type GetQuestionResponse struct {
	Data GetQuestionResponseData `json:"data"`
}

type GetQuestionResponseData

type GetQuestionResponseData struct {
	Question *Question `json:"question"`
}

type Meta

type Meta struct {
	FrontendID      string `json:"frontendQuestionId"`
	Title           string `json:"title"`
	TranslatedTitle string `json:"translatedTitle"`
	TitleSlug       string `json:"titleSlug"`
	Difficulty      string `json:"difficulty"`
	TitleCn         string `json:"titleCn"`
	Referer         string
	PaidOnly        bool `json:"paidOnly"`
}

func (*Meta) Transform

func (q *Meta) Transform()

type Question

type Question struct {
	MdContent         string `json:"mdContent"`
	QuestionID        string `json:"questionId"`
	Stats             string `json:"stats"`
	CodeDefinition    string `json:"codeDefinition"`
	SampleTestCase    string `json:"sampleTestCase"`
	Content           string `json:"content"`
	TranslatedContent string `json:"translatedContent"`
	Meta
	EnableRunCode bool `json:"enableRunCode"`
}

func (*Question) ParseCodes

func (q *Question) ParseCodes() ([]*Code, error)

func (*Question) Transform

func (q *Question) Transform(meta *Meta, refer string) error

type QustionsResp

type QustionsResp struct {
	Data struct {
		ProblemsetQuestionList struct {
			Questions []Meta `json:"questions"`
		} `json:"problemsetQuestionList"`
		Total int `json:"total"`
	} `json:"data"`
}

type RunResult

type RunResult interface {
	Display() string
	Result() string
}

type SolutionListResp

type SolutionListResp interface {
	SolutionReqs() []SolutionReq
}

type SolutionListRespCN

type SolutionListRespCN struct {
	Data struct {
		QuestionSolutionArticles struct {
			Edges []struct {
				Node struct {
					Slug      string    `json:"slug"`
					Title     string    `json:"title"`
					CreatedAt time.Time `json:"createdAt"`
					Author    struct {
						Username string `json:"username"`
					} `json:"author"`
				} `json:"node"`
			} `json:"edges"`
		} `json:"questionSolutionArticles"`
	} `json:"data"`
}

func (*SolutionListRespCN) SolutionReqs

func (sc *SolutionListRespCN) SolutionReqs() []SolutionReq

type SolutionListRespEN

type SolutionListRespEN struct {
	Data struct {
		QuestionSolutions struct {
			Solutions []struct {
				Title string `json:"title"`
				Post  struct {
					Author struct {
						Username string `json:"username"`
					} `json:"author"`
					CreationDate int `json:"creationDate"`
				} `json:"post"`
				ID int `json:"id"`
			} `json:"solutions"`
			TotalNum int `json:"totalNum"`
		} `json:"questionSolutions"`
	} `json:"data"`
}

func (*SolutionListRespEN) SolutionReqs

func (se *SolutionListRespEN) SolutionReqs() []SolutionReq

type SolutionReq

type SolutionReq struct {
	ID       string
	Title    string
	CreateAt time.Time
	Author   string
}

type SolutionResp

type SolutionResp struct {
	Data struct {
		SolutionArticle struct {
			Title    string `json:"title"`
			Summary  string `json:"summary"`
			Content  string `json:"content"`
			Question struct {
				QuestionTitleSlug string `json:"questionTitleSlug"`
				Typename          string `json:"__typename"`
			} `json:"question"`
		} `json:"solutionArticle"`
		Topic struct {
			Title string `json:"title"`
			Post  struct {
				Content    string `json:"content"`
				ID         int    `json:"id"`
				VoteCount  int    `json:"voteCount"`
				VoteStatus int    `json:"voteStatus"`
			} `json:"post"`
			ID     int  `json:"id"`
			Pinned bool `json:"pinned"`
		} `json:"topic"`
	} `json:"data"`
}

func (*SolutionResp) RegularContent

func (sp *SolutionResp) RegularContent() (string, error)

RegularContent returns regulared markdown content

type Stat

type Stat struct {
	FrontendQuestionID any    `json:"frontend_question_id"`
	QuestionTitle      string `json:"question__title"`
	QuestionTitleSlug  string `json:"question__title_slug"`
}

type StatStatusPair

type StatStatusPair struct {
	Stat       Stat       `json:"stat"`
	Difficulty Difficulty `json:"difficulty"`
	PaidOnly   bool       `json:"paid_only"`
}

func (*StatStatusPair) Meta

func (sp *StatStatusPair) Meta() Meta

type StatusCode

type StatusCode int
const (
	Accepted            StatusCode = 10
	WrongAnswer         StatusCode = 11
	MemoryLimitExceeded StatusCode = 12
	OutputLimitExceeded StatusCode = 13
	TimeLimitExceeded   StatusCode = 14
	RuntimeError        StatusCode = 15
	CompileError        StatusCode = 20
)

type SubmitCheckResult

type SubmitCheckResult struct {
	StdOutput         string  `json:"std_output"`
	CompareResult     string  `json:"compare_result"`
	ExpectedOutput    string  `json:"expected_output"`
	LastTestcase      string  `json:"last_testcase"`
	CodeOutput        string  `json:"code_output"`
	FullRuntimeError  string  `json:"full_runtime_error"`
	State             string  `json:"state"`
	FullCompileError  string  `json:"full_compile_error"`
	StatusMemory      string  `json:"status_memory"`
	StatusMsg         string  `json:"status_msg"`
	StatusRuntime     string  `json:"status_runtime"`
	MemoryPercentile  float64 `json:"memory_percentile"`
	TotalCorrect      int     `json:"total_correct"`
	TotalTestcases    int     `json:"total_testcases"`
	StatusCode        int     `json:"status_code"`
	RuntimePercentile float64 `json:"runtime_percentile"`
}

func (*SubmitCheckResult) Display

func (sr *SubmitCheckResult) Display() string

func (*SubmitCheckResult) Result

func (sr *SubmitCheckResult) Result() string

type TestCheckResult

type TestCheckResult struct {
	InputData          string
	State              string   `json:"state"`
	StatusMsg          string   `json:"status_msg"`
	FullCompileError   string   `json:"full_compile_error"`
	FullRuntimeError   string   `json:"full_runtime_error"`
	CompareResult      string   `json:"compare_result"`
	CodeAnswer         []string `json:"code_answer"`
	CodeOutput         []string `json:"code_output"`
	ExpectedCodeAnswer []string `json:"expected_code_answer"`
	StatusCode         int      `json:"status_code"`
	CorrectAnswer      bool     `json:"correct_answer"`
}

func (*TestCheckResult) Display

func (tr *TestCheckResult) Display() string

func (*TestCheckResult) Result

func (tr *TestCheckResult) Result() string

type Today

type Today struct {
	Data struct {
		ActiveDaily struct {
			Question Meta `json:"question"`
		} `json:"activeDailyCodingChallengeQuestion"`
		TodayRecord []struct {
			Question Meta `json:"question"`
		} `json:"todayRecord"`
	} `json:"data"`
}

func (*Today) Meta

func (t *Today) Meta() *Meta

Jump to

Keyboard shortcuts

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