golang

package
v1.2.17 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Key      string   `json:"key"`
	Type     string   `json:"type"`
	Lines    []string `json:"lines"`
	SkipDecl bool     `json:"skipDecl,omitempty"`
	Lints    []string `json:"lints,omitempty"`
}

func NewBlock

func NewBlock(k string, t string) *Block

func (*Block) ContainsText added in v0.10.32

func (b *Block) ContainsText(s string) bool

func (*Block) LineComplexity added in v0.10.32

func (b *Block) LineComplexity() int

func (*Block) LineCount added in v0.10.32

func (b *Block) LineCount() int

func (*Block) LineMaxLength added in v0.10.32

func (b *Block) LineMaxLength() int

func (*Block) NoLineDecl added in v0.10.32

func (b *Block) NoLineDecl(linebreak string) (string, error)

func (*Block) Render

func (b *Block) Render(linebreak string) (string, error)

func (*Block) W

func (b *Block) W(l string, args ...any)

func (*Block) WB added in v0.9.7

func (b *Block) WB()

func (*Block) WE added in v0.9.7

func (b *Block) WE(indent int, prefix ...string)

type Blocks

type Blocks []*Block

type File

type File struct {
	Package string   `json:"package,omitempty"`
	Path    []string `json:"path,omitempty"`
	Name    string   `json:"name"`
	Imports Imports  `json:"imports"`
	Blocks  Blocks   `json:"blocks"`
}

func NewFile

func NewFile(pkg string, path []string, fn string) *File

func (*File) AddBlocks

func (f *File) AddBlocks(b ...*Block)

func (*File) AddImport

func (f *File) AddImport(i ...*Import)

func (*File) Render

func (f *File) Render(addHeader bool, linebreak string) (*file.File, error)

type Import

type Import struct {
	Type  ImportType
	Value string
	Alias string
}

func NewImport

func NewImport(t ImportType, v string) *Import

func (*Import) Equals added in v0.9.19

func (i *Import) Equals(x *Import) bool

func (*Import) Render added in v0.8.24

func (i *Import) Render() string

func (*Import) WithAlias added in v0.8.24

func (i *Import) WithAlias(a string) *Import

type ImportType

type ImportType string
const (
	ImportTypeInternal ImportType = "internal"
	ImportTypeExternal ImportType = "external"
	ImportTypeApp      ImportType = "app"
)

type Imports

type Imports []*Import

func (Imports) Add

func (i Imports) Add(imports ...*Import) Imports

func (Imports) Render

func (i Imports) Render(linebreak string) string

func (Imports) RenderHTML

func (i Imports) RenderHTML(linebreak string) string

type Template

type Template struct {
	Path    []string `json:"path,omitempty"`
	Name    string   `json:"name"`
	Imports Imports  `json:"imports"`
	Blocks  Blocks   `json:"blocks"`
}

func NewGoTemplate

func NewGoTemplate(path []string, fn string) *Template

func (*Template) AddBlocks

func (f *Template) AddBlocks(b ...*Block)

func (*Template) AddImport

func (f *Template) AddImport(i ...*Import)

func (*Template) Render

func (f *Template) Render(addHeader bool, linebreak string) (*file.File, error)

Jump to

Keyboard shortcuts

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