leetcode

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2018 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeGo

type CodeGo struct {
	leetcodegraphql.Code
}

CodeGo the struct of leetcode codes.

type ICode

type ICode interface {
	// contains filtered or unexported methods
}

ICode the Code interface

type LanguageType

type LanguageType string

LanguageType type of language

const (
	// LanguageGo golang language
	LanguageGo LanguageType = "golang"
)

func (LanguageType) String

func (l LanguageType) String() string

String returns a string

type Markdown

type Markdown struct {
	File    string  `json:"-"`
	Problem Problem `json:"-"`
}

Markdown the struct of leetcode markdown template manager.

func NewMarkdown

func NewMarkdown(file string, p Problem) *Markdown

NewMarkdown returns new Markdown impl.

type MarkdownFragments

type MarkdownFragments struct {
	ID          string
	TitleSlug   string
	Title       string
	Language    string
	Difficulty  string
	DirName     string
	PackageName string
}

MarkdownFragments the struct of leetcode markdown template.

type Problem

type Problem struct {
	Question Question
	Language LanguageType `json:"language"`
	Markdown string       `json:"markdown"`
}

Problem the struct of leetcode problem.

func NewProblem

func NewProblem(lang LanguageType, key, markdown string) *Problem

NewProblem returns new Problem instance with a title string.

func NewProblemByURI

func NewProblemByURI(lang LanguageType, uri, markdown string) *Problem

NewProblemByURI returns new Problem instance with a url string.

func (Problem) OutputCode

func (p Problem) OutputCode() error

OutputCode save to src code file with language.

func (Problem) OutputMarkdown

func (p Problem) OutputMarkdown() error

OutputMarkdown prints markdown template.

func (Problem) OutputReadMe

func (p Problem) OutputReadMe() error

OutputReadMe save to README.md.

func (Problem) OutputTestCode

func (p Problem) OutputTestCode() error

OutputTestCode save to test code file with language.

func (*Problem) Parse

func (p *Problem) Parse() error

Parse parses URL and constructs.

func (Problem) ReadMe

func (p Problem) ReadMe() string

ReadMe convert description to markdown.

func (Problem) String

func (p Problem) String() string

String returns a string.

type Question

type Question struct {
	leetcodegraphql.BaseQuestion
	TitleSlug string `json:"-"`
}

Question the struct of leetcode question.

func (Question) Code

func (q Question) Code(lang LanguageType) (ICode, error)

Code get a Code by key string

func (*Question) Parse

func (q *Question) Parse() error

Parse parses the response to constructs.

func (Question) String

func (q Question) String() string

String returns a string.

Jump to

Keyboard shortcuts

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