Documentation ¶
Overview ¶
Package gotpl provides a Go template for xo.
Index ¶
- Constants
- Variables
- func Conflict(ctx context.Context) string
- func Context(ctx context.Context) string
- func Custom(ctx context.Context) string
- func Esc(ctx context.Context) []string
- func FieldTag(ctx context.Context) string
- func Import(ctx context.Context) []string
- func Inject(ctx context.Context) string
- func InjectFile(ctx context.Context) string
- func Int32(ctx context.Context) string
- func NotFirst(ctx context.Context) bool
- func Pkg(ctx context.Context) string
- func Tag(ctx context.Context) []string
- func Uint32(ctx context.Context) string
- type Funcs
- type PackageImport
Constants ¶
View Source
const ( NotFirstKey templates.ContextKey = "not-first" Int32Key templates.ContextKey = "int32" Uint32Key templates.ContextKey = "uint32" PkgKey templates.ContextKey = "pkg" TagKey templates.ContextKey = "tag" ImportKey templates.ContextKey = "import" CustomKey templates.ContextKey = "custom" ConflictKey templates.ContextKey = "conflict" EscKey templates.ContextKey = "esc" FieldTagKey templates.ContextKey = "field-tag" ContextKey templates.ContextKey = "context" InjectKey templates.ContextKey = "inject" InjectFileKey templates.ContextKey = "inject-file" )
Context keys.
Variables ¶
View Source
var Files embed.FS
Files are the embedded Go templates.
Functions ¶
func InjectFile ¶
InjectFile returns inject-file from the context.
Types ¶
type Funcs ¶
type Funcs struct {
// contains filtered or unexported fields
}
Funcs is a set of template funcs.
func NewFuncs ¶
func NewFuncs(ctx context.Context, knownTypes map[string]bool, shortNames map[string]string, first *bool) (*Funcs, error)
NewFuncs returns a set of template funcs.
func (*Funcs) AddKnownType ¶
AddKnownType adds a known type.
type PackageImport ¶
PackageImport holds information about a Go package import.
func (PackageImport) String ¶
func (v PackageImport) String() string
String satisfies the fmt.Stringer interface.
Click to show internal directories.
Click to hide internal directories.