accessor

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 16 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 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
	NoDefault bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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