codegen

package
v1.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractStructFieldTagByJSONName

func ExtractStructFieldTagByJSONName(tagMap TagMap) ast.Visitor

ExtractStructFieldTagByJSONName returns an ast.Visitor that extracts struct field tag value by field's JSON name to tagMap. Kubebuilder struct field may have no name because it can be embedded in the struct (e.g. ObjectMeta). To cover this case, it depends on the field's JSON name, not the field name (which may be empty).

func InjectStructFieldTagByJSONName

func InjectStructFieldTagByJSONName(tagMap TagMap) ast.Visitor

InjectStructFieldTagByJSONName returns an ast.Visitor that injects struct field tags by field's JSON name if the given struct field's tag exists in tagMap.

Types

type TagMap

type TagMap map[string]map[string]*structtag.Tags

TagMap is a map of struct name -> field json name -> field tags

Jump to

Keyboard shortcuts

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