accessor

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(fs afero.Fs, src *ParsedSource, options ...Option) error

Types

type Field

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

Field contains the information of a field in a struct.

type Import added in v0.3.1

type Import struct {
	Name    string
	Path    string
	IsNamed bool
}

Import contains the information of an import.

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 ParsedSource added in v0.3.1

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

ParsedSource contains the parsed source of a package.

func Parse added in v0.3.1

func Parse(dir string) (*ParsedSource, error)

type Struct

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

Struct contains the information of a struct.

type Tag

type Tag struct {
	Getter    *string
	Setter    *string
	NoDefault bool
}

Tag contains the information of a struct field's tag.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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