Documentation ¶
Index ¶
- Constants
- Variables
- func LoadTemplates(out *Templates, list map[string]string) error
- func WriteReadme(w io.Writer, tpl *template.Template, data any) error
- type GenerationResult
- type Generator
- type Option
- type OverloadTemplate
- type Problem
- type ProblemsGroup
- type ProblemsProvider
- type Provider
- type RenderFormatter
- type Solution
- type SolutionFile
- type Source
- type Stats
- type StructureProvider
- type TemplateSource
- type Templates
Constants ¶
View Source
const ( DifficultyEasy difficulty = iota DifficultyMedium DifficultyHard )
View Source
const ( TplSourceMarkdownName = "source_markdown" TplIndexMarkdownName = "index" )
Variables ¶
View Source
var DefaultTemplates = map[string]string{ TplIndexMarkdownName: TplIndexMarkdown, TplSourceMarkdownName: TplSourceMarkdown, }
View Source
var TplIndexMarkdown = `` /* 137-byte string literal not displayed */
View Source
var TplSourceMarkdown = `` /* 490-byte string literal not displayed */
Functions ¶
Types ¶
type GenerationResult ¶
type GenerationResult struct {
// contains filtered or unexported fields
}
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator is the main structure responsible for readme generation from different sources of problems.
func NewGenerator ¶
func NewGenerator( outputDir string, templates *Templates, sp StructureProvider, pp []Provider, options ...Option, ) *Generator
NewGenerator returns new algo source readme generator.
type Option ¶ added in v0.0.2
type Option func(g *Generator)
func HideUnsolvedProblems ¶ added in v0.0.2
func HideUnsolvedProblems() Option
HideUnsolvedProblems returns option to be set for generator to hide unsolved problems.
type OverloadTemplate ¶
type ProblemsGroup ¶ added in v0.0.2
func GroupByLevel ¶ added in v0.0.2
func GroupByLevel(s Stats) []ProblemsGroup
type ProblemsProvider ¶
type ProblemsProvider interface { // GetAllProblems returns list of all problems of algo Provider no matter solved they or not. GetAllProblems(ctx context.Context) ([]Problem, error) }
ProblemsProvider - source of single source of algorithmic problems. E.g. - leetcode, hackerrank, etc.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func NewProvider ¶
func NewProvider(name string, cacheDir string, base ProblemsProvider) Provider
type RenderFormatter ¶
type SolutionFile ¶
type Stats ¶ added in v0.0.2
type Stats struct { Solved int64 // contains filtered or unexported fields }
func (Stats) SolvedPercentString ¶ added in v0.0.3
type StructureProvider ¶
type StructureProvider interface { GetSolvedProblems(ctx context.Context, sourceName string) ([]Solution, error) GetProblemUID(p Problem) string }
StructureProvider is the source that knows directory & files structure of all solved problems.
type TemplateSource ¶
Click to show internal directories.
Click to hide internal directories.