iwrapper

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPkgName = errors.New("no package name")
)

Functions

func Generate

func Generate(w io.Writer, pkgName string, confs []*GenerateConfig) error

Types

type AnonymousInterface

type AnonymousInterface struct {
	// contains filtered or unexported fields
}

func NewAnonymousInterface

func NewAnonymousInterface(interfaces []*Interface) *AnonymousInterface

func (*AnonymousInterface) Expr

func (ai *AnonymousInterface) Expr() ([]*Package, ast.Expr)

type GenerateConfig

type GenerateConfig struct {
	FuncName           string
	RequireInterface   *AnonymousInterface
	WrappedInterface   *NamedInterface
	OptionalInterfaces []*Interface
}

func Convert

func Convert(results []*ParseResult) ([]*GenerateConfig, error)

type Interface

type Interface struct {
	// contains filtered or unexported fields
}

func NewInterface

func NewInterface(pkg *Package, name string) *Interface

func (*Interface) Expr

func (i *Interface) Expr() (*Package, ast.Expr)

type NamedInterface

type NamedInterface struct {
	// contains filtered or unexported fields
}

func NewNamedInterface

func NewNamedInterface(name string, interfaces []*Interface, declared bool) *NamedInterface

func (*NamedInterface) Decl

func (n *NamedInterface) Decl() ([]*Package, *ast.GenDecl)

func (*NamedInterface) Expr

func (ni *NamedInterface) Expr() ast.Expr

type Package

type Package struct {
	// contains filtered or unexported fields
}

func NewPackage

func NewPackage(name, path string, isRequireName bool) *Package

func (*Package) Expr

func (p *Package) Expr() ast.Expr

func (*Package) ID

func (p *Package) ID() string

func (*Package) ImportSpec

func (p *Package) ImportSpec() *ast.ImportSpec

type ParseResult

type ParseResult struct {
	FuncName, StructName                   string
	RequiredInterfaces, OptionalInterfaces []*Interface
}

func ParseTarget

func ParseTarget(r io.Reader) (string, []*ParseResult, error)

Jump to

Keyboard shortcuts

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