file

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	// Len is the length of the array.
	//
	// A negative value indicates that this is a slice.
	Len int64

	Elem Type
}

Array is a Type representing arrays and slices.

func (Array) String

func (t Array) String() string

type ImportManager

type ImportManager struct {
	// Imports is a map of import names to their paths, used to prevent
	// collisions.
	Imports map[string]string // map[importName]importPath
}

func NewImportManager

func NewImportManager() *ImportManager

func (*ImportManager) Add

func (m *ImportManager) Add(path string) string

type Map

type Map struct {
	Key, Value Type
}

func (Map) String

func (t Map) String() string

type Method

type Method struct {
	// Name is the name of the file.
	Name    string
	Params  []Param
	Returns []Return
}

func NewMethod

func NewMethod(f *types.Func, im *ImportManager) (*Method, error)

type Named

type Named struct {
	// Package is the name of the package this type belongs to, if any.
	//
	// If an import alias was used, Package will be the alias.
	Package string
	// PackagePath is the import path of the package of the type.
	PackagePath string

	// Name is the name of the type.
	Name string
}

Named is a Type representing all named types, such as structs, interfaces, or primitives.

func (Named) String

func (t Named) String() string

type Param

type Param struct {
	// Name is the name of the parameter.
	//
	// If the parameter was not named in the interface definition, Name
	// will be generated by dblog.
	Name string
	// GeneratedName indicates whether Name was generated by dblog.
	GeneratedName bool
	// Type is the type of the parameter.
	Type Type
	// Variadic indicates whether the parameter is variadic.
	//
	// This can only be true for the last parameter.
	Variadic bool
}

func NewParam

func NewParam(v *types.Var, ng nameGenerator, im *ImportManager) (_ *Param, err error)

type Pointer

type Pointer struct {
	Elem Type
}

func (Pointer) String

func (p Pointer) String() string

type Return

type Return struct {
	// Name is the name of the return value and is also used as the name of
	// the variable that holds this return value.
	//
	// If the return value was not named in the interface definition, Name
	// will be generated by dblog.
	Name string
	// GeneratedName indicates whether Name was generated by dblog.
	GeneratedName bool
	// Type is the type of the return value.
	Type Type
}

func NewReturn

func NewReturn(v *types.Var, ng nameGenerator, im *ImportManager) (_ *Return, err error)

type Type

type Type interface {
	String() string
	// contains filtered or unexported methods
}

func NewType

func NewType(t types.Type, m *ImportManager) (Type, error)

Jump to

Keyboard shortcuts

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