annotations

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	StructureName   string `annotation:"name=name,default={{.TypeName}}Builder"`
	ConstructorName string `annotation:"name=constructor,default=New{{.TypeName}}Builder"`
	BuildPattern    string `annotation:"name=build,default={{.FieldName}}"`
	BuilderName     string `annotation:"name=terminator,default=Build"`
	Type            string `annotation:"name=type,default=struct,oneOf=struct;pointer"`
	Exported        bool   `annotation:"name=exported,default=true"`
}

func (Builder) BuildBuildName

func (b Builder) BuildBuildName(fieldName string) string

func (Builder) BuildConstructorName

func (b Builder) BuildConstructorName(typeName string) string

func (Builder) BuildStructureName

func (b Builder) BuildStructureName(typeName string) string

type Constructor

type Constructor struct {
	Name     string `annotation:"name=name,default=New{{.TypeName}}"`
	Type     string `annotation:"name=type,default=struct,oneOf=struct;pointer"`
	Exported bool   `annotation:"name=exported,default=true"`
}

func (Constructor) BuildName

func (c Constructor) BuildName(typeName string) string

type Exclude

type Exclude struct{} // Excludes structure field from constructors

type Init

type Init struct {
	Len int `annotation:"name=len,default=-1"`
	Cap int `annotation:"name=cap,default=-1"`
}

Init is used for fields initialisation such as slice, map, chan If Init.Len and Init.Cap then the values are set by default (chan is non-buffered)

type Optional

type Optional struct {
	Name            string `annotation:"name=name,default={{.TypeName}}Option"`
	ConstructorName string `annotation:"name=constructor,default=New{{.TypeName}}"`
	WithPattern     string `annotation:"name=with,default=With{{.FieldName}}"`
	Type            string `annotation:"name=type,default=struct,oneOf=struct;pointer"`
	Exported        bool   `annotation:"name=exported,default=true"`
}

func (Optional) BuildConstructorName

func (o Optional) BuildConstructorName(typeName string) string

func (Optional) BuildName

func (o Optional) BuildName(typeName string) string

func (Optional) BuildWithName

func (o Optional) BuildWithName(fieldName string) string

type PostConstruct

type PostConstruct struct {
	Priority int `annotation:"name=priority,default=1"`
}

Jump to

Keyboard shortcuts

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