engine

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const AutocodeMarker = "autocode"
View Source
const AutocodeMaxLengthMarker = "len"
View Source
const AutocodeMaxMarker = "max"
View Source
const AutocodeMinMarker = "min"
View Source
const AutocodeTypeMarker = "type"
View Source
const AutocodeValueMarker = "val"
View Source
const CodeMarker = "code"
View Source
const CodeSyntaxPattern = "(" + CodeMarker + "(\\[[a-zA-Z]+\\])" + "|" + AutocodeMarker + ")"
View Source
const HeaderMarker = "header"
View Source
const IgnoreFileMarker = "ignore-file"
View Source
const IgnoreMarker = "ignore"
View Source
const MarkerDelimiter = "@"
View Source
const TitleMarker = "title"

Variables

View Source
var TestProtoDescriptor []byte

Functions

func LinkToParagraph

func LinkToParagraph(p *md.Paragraph, url, label string)

func MkBlockquote

func MkBlockquote() *md.Blockquote

func MkCode

func MkCode(code string) *md.Codeblock

func MkEnumRef

func MkEnumRef(enum *Enum) *md.HtmlRef
func MkFieldTypeLink(field *MessageField) *md.Link

func MkHeader

func MkHeader(text string, level md.HeaderLevel) *md.Header

func MkImage

func MkImage(url, text, title string) *md.Image
func MkLink(name, fullName string) *md.Link

func MkList

func MkList(ordered bool, parent *md.List) *md.List

func MkListEntry

func MkListEntry(list *md.List, element md.Element) *md.ListEntry

func MkListTextEntry

func MkListTextEntry(list *md.List, text string) *md.ListEntry

func MkMessageRef

func MkMessageRef(msg *Message) *md.HtmlRef

func MkParagraph

func MkParagraph() *md.Paragraph

func MkRow

func MkRow() *md.Row

func MkRule

func MkRule() *md.Rule

func MkTable

func MkTable(rows int) *md.Table

func MkText

func MkText(text string, emphasis md.TextEmphasis) *md.Text

func TextToParagraph

func TextToParagraph(p *md.Paragraph, text string, emphasis md.TextEmphasis)

Types

type AutocodeOpt

type AutocodeOpt struct {
	// contains filtered or unexported fields
}

type Codegenerator

type Codegenerator struct {
	// contains filtered or unexported fields
}

func NewCodegenerator

func NewCodegenerator() *Codegenerator

func (*Codegenerator) Generate

func (g *Codegenerator) Generate(files []ParsedFile, message *Message) (*md.Codeblock, error)

type Config

type Config struct {
	EmphasisSyntax  md.EmphasisSyntax
	HeaderSyntax    md.HeaderSyntax
	RuleSyntax      md.RuleSyntax
	CodeblockSyntax md.CodeblockSyntax
	ListSyntax      md.ListSyntax
}

func DefaultRenderConfig

func DefaultRenderConfig() *Config

type DescriptorParser

type DescriptorParser struct {
	// contains filtered or unexported fields
}

func NewDescriptorParser

func NewDescriptorParser(request *plugingo.CodeGeneratorRequest) *DescriptorParser

func (*DescriptorParser) Parse

func (p *DescriptorParser) Parse() ([]ParsedFile, error)

type Entry

type Entry struct {
	// contains filtered or unexported fields
}

type EntryType

type EntryType int
const (
	EntryTypeMessage EntryType = iota
	EntryTypeEnum    EntryType = iota
)

type Enum

type Enum struct {
	// contains filtered or unexported fields
}

type EnumField

type EnumField struct {
	// contains filtered or unexported fields
}

type FieldFlags

type FieldFlags struct {
	// contains filtered or unexported fields
}

func (FieldFlags) GetCustomType

func (a FieldFlags) GetCustomType() opt.Opt[ValueType]

func (FieldFlags) GetMax

func (a FieldFlags) GetMax() opt.Opt[float64]

func (FieldFlags) GetMaxLength

func (a FieldFlags) GetMaxLength() opt.Opt[int]

func (FieldFlags) GetMin

func (a FieldFlags) GetMin() opt.Opt[float64]

func (FieldFlags) GetValue

func (a FieldFlags) GetValue() opt.Opt[string]

type Generator

type Generator[R any] interface {
	Generate(messages []Message) (*R, error)
}

type MDGenerator

type MDGenerator struct {
	// contains filtered or unexported fields
}

func NewMDGenerator

func NewMDGenerator(codegen *Codegenerator) *MDGenerator

func (*MDGenerator) Generate

func (g *MDGenerator) Generate(parsedFiles []ParsedFile) (*md.Document, error)

type MarkdownRenderer

type MarkdownRenderer struct {
	// contains filtered or unexported fields
}

func NewMarkdownRenderer

func NewMarkdownRenderer(config *Config) *MarkdownRenderer

func (*MarkdownRenderer) Render

func (g *MarkdownRenderer) Render(doc *md.Document) (string, error)

type Message

type Message struct {
	// contains filtered or unexported fields
}

type MessageField

type MessageField struct {
	// contains filtered or unexported fields
}

func NewMessageField

func NewMessageField(d *protokit.FieldDescriptor, m *protokit.Descriptor, description string, valueType ValueType, flags *FieldFlags) *MessageField

func (*MessageField) Descriptor

func (m *MessageField) Descriptor() *protokit.FieldDescriptor

func (*MessageField) ValueType

func (m *MessageField) ValueType() ValueType

type ParsedFile

type ParsedFile struct {
	// contains filtered or unexported fields
}

func (ParsedFile) Filename

func (p ParsedFile) Filename() string

func (ParsedFile) Index

func (p ParsedFile) Index() int

func (ParsedFile) Title

func (p ParsedFile) Title() string

type Renderer

type Renderer interface {
	Render(doc *md.Document) (string, error)
}

type Syntax

type Syntax int
const (
	SyntaxJson Syntax = iota
	SyntaxXml
)

type Text

type Text struct {
	// contains filtered or unexported fields
}

type ValueType

type ValueType int
const (
	ValueTypeInt ValueType = iota
	ValueTypeUInt
	ValueTypeFloat
	ValueTypeBool
	ValueTypeString
	ValueTypeEnum
	ValueTypeJWT
	ValueTypeUUID
	ValueTypeStruct
	ValueTypeEmail
	ValueTypePhone
	ValueTypePassword
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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