template

package
v0.0.0-...-f670af2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Header = Tr[string](AtPackage, `package {{ . }}
`)
View Source
var Import = Tr[map[string]string](AtImport, `
import (
	{{ range $key, $val := . }}
		 {{- $key }} {{ $val }}
	{{ end }}
)

`)

Functions

func Tr

func Tr[Data any](w CodePosition, t string) templateRenderer[Data]

Types

type CodePosition

type CodePosition int
const (
	AtPackage CodePosition = 0 + iota
	AtImport
	AtConstants
	AtTypes
	AtConstructor
	AtMethod
	AtFunc
	AtEOF
)

type Renderer

type Renderer[Data any] interface {
	With(d Data) RendererResult
}

type RendererResult

type RendererResult interface {
	Bytes() []byte
	Weight() int
	ID() string
	Imports() []string
	Error() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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