wrapgen

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadInterfaces

func LoadInterfaces(ctx context.Context, srcPkg, srcPkgAlias string, names []string) ([]*Import, []*Interface, error)

Types

type FSTemplateFetcher

type FSTemplateFetcher struct {
	ReadFn func(string) ([]byte, error)
}

FSTemplateFetcher treats any given path as existing on the file system and attempts to open the file.

func (*FSTemplateFetcher) FetchTemplate

func (f *FSTemplateFetcher) FetchTemplate(ctx context.Context, path string) (string, error)

FetchTemplate attempts to load from the file system.

type HTTPTemplateFetcher

type HTTPTemplateFetcher struct {
	Client *http.Client
}

HTTPTemplateFetcher treats any given path as a URL and attempts to download the content via a GET.

func (*HTTPTemplateFetcher) FetchTemplate

func (f *HTTPTemplateFetcher) FetchTemplate(ctx context.Context, path string) (string, error)

FetchTemplate attempts to load via GET.

type Import

type Import struct {
	Package string
	Path    string
}

Import is a package name and path that is imported by another package.

type Interface

type Interface struct {
	SrcType Type // e.g. srcPkgAlias.ExportedType
	Name    string
	Methods []*Method
}

Interface is an exported interface defined in a package.

type Method

type Method struct {
	Name string
	In   []*Parameter
	Out  []*Parameter
}

Method is a named function attached to an interface.

type MultiTemplateFetcher

type MultiTemplateFetcher []TemplateFetcher

MultiTemplateFetcher takes an ordered set of TemplateFetcher instances an attempts to call each one until a response if received or all fail.

func (MultiTemplateFetcher) FetchTemplate

func (f MultiTemplateFetcher) FetchTemplate(ctx context.Context, path string) (string, error)

type Package

type Package struct {
	Name       string
	Source     *Import
	Interfaces []*Interface
	Imports    []*Import
	// ImportsWithSource will contain Source if the destination package is set and
	// Source is not included in Imports.
	ImportsWithSource []*Import
}

Package is a container for all exported interfaces of a Go package.

func LoadPackage added in v2.4.0

func LoadPackage(ctx context.Context, srcPkg string, dstPkg string, names []string) (*Package, error)

type Parameter

type Parameter struct {
	Name string
	Type Type
}

Parameter is a named parameter used by a Method.

type TemplateFetcher

type TemplateFetcher interface {
	FetchTemplate(ctx context.Context, path string) (string, error)
}

TemplateFetcher is used to load a template from some source.

type Type

type Type interface {
	String() string
}

Type is a Go type definition that can be rendered into a valid Go code snippet.

type TypeArray

type TypeArray struct {
	Len  int
	Type Type
}

TypeArray is a slice or array type.

func (*TypeArray) String

func (t *TypeArray) String() string

type TypeBuiltin

type TypeBuiltin string

TypeBuiltin is a built in Go type such as "string" or "bool".

func (TypeBuiltin) String

func (t TypeBuiltin) String() string

type TypeChan

type TypeChan struct {
	ReadOnly  bool
	WriteOnly bool
	Type      Type
}

TypeChan is a channel type.

func (*TypeChan) String

func (t *TypeChan) String() string

type TypeExported

type TypeExported struct {
	Package string
	Type    Type
}

TypeExported is a user defined type that is exported from a package.

func (*TypeExported) String

func (t *TypeExported) String() string

type TypeFunc

type TypeFunc struct {
	In  []Type
	Out []Type
}

TypeFunc is an input type of a function.

func (*TypeFunc) String

func (t *TypeFunc) String() string

type TypeMap

type TypeMap struct {
	Key   Type
	Value Type
}

TypeMap is a user defined map type.

func (*TypeMap) String

func (t *TypeMap) String() string

type TypePointer

type TypePointer struct {
	Type Type
}

TypePointer is a pointer to another type.

func (*TypePointer) String

func (t *TypePointer) String() string

type TypeVariadic

type TypeVariadic struct {
	Type Type
}

TypeVariadic is any type that is prefixed by Ellipsis.

func (*TypeVariadic) String

func (t *TypeVariadic) String() string

Directories

Path Synopsis
test
happy
Package happy contains all possible success cases that we expect to see.
Package happy contains all possible success cases that we expect to see.

Jump to

Keyboard shortcuts

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