Documentation
¶
Index ¶
- Variables
- func GetSolutionCode(q *leetcode.QuestionData) (string, error)
- func ReadVersion(file string) (string, error)
- func RunLocalTest(q *leetcode.QuestionData, targetCase string) (bool, error)
- func UpdateSolutionCode(q *leetcode.QuestionData, newCode string) error
- type CargoToml
- type FileOutput
- type FileType
- type GenerateResult
- type JudgeResult
- type Judger
- type Lang
- type LocalTestable
- type ModifierFunc
- type NeedInitialization
- type Range
- type TestCase
- type TestCases
Constants ¶
This section is empty.
Variables ¶
View Source
var (
SupportedLangs = []Lang{
golangGen,
python3Gen,
cppGen,
rustGen,
javaGen,
jsGen,
tsGen,
phpGen,
cGen,
csharpGen,
rubyGen,
swiftGen,
kotlinGen,
bashGen,
mysqlGen,
mssqlGen,
oraclesqlGen,
erlangGen,
racketGen,
scalaGen,
elixirGen,
dartGen,
}
)
Functions ¶
func GetSolutionCode ¶
func GetSolutionCode(q *leetcode.QuestionData) (string, error)
func ReadVersion ¶ added in v1.3.1
func RunLocalTest ¶
func RunLocalTest(q *leetcode.QuestionData, targetCase string) (bool, error)
func UpdateSolutionCode ¶ added in v0.2.2
func UpdateSolutionCode(q *leetcode.QuestionData, newCode string) error
Types ¶
type CargoToml ¶ added in v1.3.1
type CargoToml struct {
CargoFeatures []string `toml:"cargo-features,omitempty"`
Package map[string]any `toml:"package,omitempty"`
Lib map[string]any `toml:"lib,omitempty"`
Bin []map[string]any `toml:"bin,omitempty"`
Example []map[string]any `toml:"example,omitempty"`
Test []map[string]any `toml:"test,omitempty"`
Bench []map[string]any `toml:"bench,omitempty"`
Dependencies map[string]any `toml:"dependencies"`
DevDependencies map[string]any `toml:"dev-dependencies,omitempty"`
BuildDependencies map[string]any `toml:"build-dependencies,omitempty"`
Target map[string]any `toml:"target,omitempty"`
Badge map[string]any `toml:"badge,omitempty"`
Features map[string]any `toml:"features,omitempty"`
Patch map[string]any `toml:"patch,omitempty"`
Replace map[string]any `toml:"replace,omitempty"`
Profile map[string]any `toml:"profile,omitempty"`
Workspace map[string]any `toml:"workspace,omitempty"`
}
type FileOutput ¶
type FileOutput struct {
Filename string
Type FileType
Content string
Written bool
// contains filtered or unexported fields
}
func (*FileOutput) GetContent ¶ added in v1.3.1
func (f *FileOutput) GetContent() (string, error)
func (*FileOutput) GetPath ¶ added in v1.3.1
func (f *FileOutput) GetPath() string
type GenerateResult ¶
type GenerateResult struct {
Question *leetcode.QuestionData
Lang Lang
OutDir string
SubDir string
Files []FileOutput
ResultHooks []func(*GenerateResult) error
// contains filtered or unexported fields
}
func Generate ¶
func Generate(q *leetcode.QuestionData) (*GenerateResult, error)
func GenerateContest ¶
func GenerateContest(ct *leetcode.Contest) ([]*GenerateResult, error)
func GeneratePathsOnly ¶
func GeneratePathsOnly(q *leetcode.QuestionData) (*GenerateResult, error)
GeneratePathsOnly runs generate process but does not generate real content.
func (*GenerateResult) AddFile ¶ added in v1.3.1
func (r *GenerateResult) AddFile(f FileOutput) *GenerateResult
func (*GenerateResult) GetFile ¶ added in v1.3.1
func (r *GenerateResult) GetFile(typ FileType) *FileOutput
func (*GenerateResult) SetOutDir ¶ added in v1.3.1
func (r *GenerateResult) SetOutDir(dir string)
func (*GenerateResult) TargetDir ¶ added in v1.3.1
func (r *GenerateResult) TargetDir() string
type JudgeResult ¶ added in v1.3.1
type Judger ¶ added in v1.3.1
type Judger interface {
Judge(input []string, output, actualOutput string) JudgeResult
}
func GetJudger ¶ added in v1.3.1
func GetJudger(q *leetcode.QuestionData) Judger
type Lang ¶
type Lang interface {
Name() string
ShortName() string
Slug() string
// Generate generates code files for the question.
Generate(q *leetcode.QuestionData) (*GenerateResult, error)
GeneratePaths(q *leetcode.QuestionData) (*GenerateResult, error)
}
func GetGenerator ¶
type LocalTestable ¶
type ModifierFunc ¶ added in v0.1.6
type ModifierFunc = func(string, *leetcode.QuestionData) string
type NeedInitialization ¶
type TestCase ¶ added in v1.3.1
type TestCase struct {
Question *leetcode.QuestionData
No int
Input []string
Output string
}
func (*TestCase) InputString ¶ added in v1.3.1
type TestCases ¶ added in v1.3.1
type TestCases struct {
Cases []TestCase
Question *leetcode.QuestionData
}
func ParseTestCases ¶ added in v1.3.1
func ParseTestCases(q *leetcode.QuestionData, f *FileOutput) (TestCases, error)
Click to show internal directories.
Click to hide internal directories.