codegen

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package codegen emits reflection-free configbind apply, flag, and env key tables.

Index

Constants

View Source
const (
	FieldString      = codegen.FieldString
	FieldBool        = codegen.FieldBool
	FieldInt         = codegen.FieldInt
	FieldDuration    = codegen.FieldDuration
	FieldStringSlice = codegen.FieldStringSlice
	FieldStruct      = codegen.FieldStruct
	FieldStructSlice = codegen.FieldStructSlice
)

Variables

This section is empty.

Functions

func Generate

func Generate(packageName string, specs []Spec) ([]byte, error)

Generate emits package source that registers one Definition for each Spec.

func GenerateGroup added in v0.1.13

func GenerateGroup(packageName string, specs []Spec, indexOffset int) ([]byte, error)

GenerateGroup generates one subset of a package's specs. indexOffset is the position of specs[0] within the package's full spec list; it keeps generated identifiers unique when a package is emitted as several files.

Types

type Field

type Field = codegen.Field

Field and FieldKind re-export for callers.

type FieldKind

type FieldKind = codegen.FieldKind

Field and FieldKind re-export for callers.

type Spec

type Spec struct {
	PackagePath string
	TypeName    string
	Prefix      string
	SubCommand  bool
	Name        string
	Help        string
	// Doc is the struct's godoc text. Bind specs render it above the scaffold
	// table; subcommand specs fall back to it when Help is empty.
	Doc    string
	Fields []Field
}

Spec is a Bind-style struct and prefix discovered in one Go package.

Jump to

Keyboard shortcuts

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