generators

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoLine

func DoLine(sw *generator.SnippetWriter, indent, format string, args any)

func IgnoreKeys

func IgnoreKeys(keys ...string) string

func NewOverlayGenerator

func NewOverlayGenerator(outputFilename, targetPackage string) generator.Generator

func NewOverlayTestGenerator

func NewOverlayTestGenerator(outputFilename, targetPackage string) generator.Generator

func Panic

func Panic(msg string, args ...any)

Types

type AnnotateType

type AnnotateType int
const (
	None AnnotateType = iota
	AtomicList
	SetList
	MapList

	AtomicMap
	GranularMap

	AtomicStruct
	GranularStruct
)

func (AnnotateType) FuncPrefix

func (at AnnotateType) FuncPrefix() string

type Params

type Params interface {
	Name() string
	// Type returns the type dst and src
	Type() *types.Type
	// Dst returns the variable name of dst
	Dst() string
	// Src returns the variable name of src
	Src() string

	// AnnotateType returns the type from comments
	AnnotateType() AnnotateType
	// Keys returns additional keys of specified annotate type
	Keys() []string

	// some types need check nil before get address
	CheckNil()

	Member() *types.Member

	Members() []Params
	Pointer() Params
	Slice(dst, src string) Params
	Map() Params
	Underlying() Params
}

Params defines the messages of overlay params

func NewParams

func NewParams(name string, t *types.Type, comments []string) Params

TODO: handle panic

type Refer

type Refer interface {
	Ref(root string) string
}

func Addr

func Addr(notNil *bool) Refer

func Field

func Field(f string) Refer

func Index

func Index(i string) Refer

func Pointer

func Pointer() Refer

func Prefix

func Prefix(p string) Refer

type StructField

type StructField struct {
	Name string
	Type *types.Type
}

Jump to

Keyboard shortcuts

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