wrapper

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: MIT Imports: 13 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 wrapper methods.

Types

type Field

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

type Option

type Option func(*generator)

func Interface

func Interface(interfaceName string) Option

Wrapper type name

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 Reader added in v1.1.1

func Reader(reader bool) Option

Implement io.Reader

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.

func Wrapper

func Wrapper(typ string) Option

Wrapper type name

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