accessor

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(fs afero.Fs, pkg *Package, options ...Option) error

Generate generates a file and accessor methods.

Types

type Field

type Field struct {
	Name string
	Type types.Type
	Tag  *Tag
}

type Option

type Option func(*generator)

func ForceGetters

func ForceGetters(getters bool) Option

ForceGetters sets force generation for getters

func ForceSetters added in v0.1.3

func ForceSetters(setters bool) Option

ForceSetters sets force generation for setters

func GettersPrefix added in v0.1.4

func GettersPrefix(prefix string) Option

GettersPrefix sets prefix for getter methods

func Lock

func Lock(lock string) Option

Lock sets lock field name to genarator.

func Output

func Output(output string) Option

Output sets output file path to genarator.

func Receiver

func Receiver(receiver string) Option

Receiver sets receiver name to genarator.

func Type

func Type(typeName string) Option

Type sets type name to genarator.

type Package

type Package struct {
	*packages.Package
	Dir     string
	Structs []*Struct
}

func ParsePackage

func ParsePackage(dir string) (*Package, error)

ParsePackage parses the specified directory's package.

type Struct

type Struct struct {
	Name   string
	Fields []*Field
}

type Tag

type Tag struct {
	Getter *string
	Setter *string
}

Jump to

Keyboard shortcuts

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