model

package
v0.0.0-...-87e272f Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package model contains the data model necessary for generating stub implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayType

type ArrayType struct {
	Len  int // -1 for slices, >= 0 for arrays
	Type Type
}

ArrayType is an array or slice type.

func (*ArrayType) String

func (at *ArrayType) String(pm map[string]string, pkgOverride string) string

type ChanDir

type ChanDir int

ChanDir is a channel direction.

const (
	RecvDir ChanDir = 1
	SendDir ChanDir = 2
)

Constants for channel directions.

type ChanType

type ChanType struct {
	Dir  ChanDir // 0, 1 or 2
	Type Type
}

ChanType is a channel type.

func (*ChanType) String

func (ct *ChanType) String(pm map[string]string, pkgOverride string) string

type Export

type Export interface {
	Declaration(pm map[string]string, pkgOverride string) string
	// contains filtered or unexported methods
}

type Field

type Field struct {
	Name string
	Type Type
}

func (*Field) String

func (f *Field) String(pm map[string]string, pkgOverride string) string

type FuncType

type FuncType struct {
	In, Out  []*Parameter
	Variadic *Parameter // may be nil
}

FuncType is a function type.

func (*FuncType) String

func (ft *FuncType) String(pm map[string]string, pkgOverride string) string

type Function

type Function struct {
	Name string
	Type *FuncType
}

Function is a function

func (*Function) Declaration

func (f *Function) Declaration(pm map[string]string, pkgOverride string) string

type InterfaceType

type InterfaceType struct {
	Methods []*Method
}

InterfaceType is an interface type.

var EmptyInterface *InterfaceType = &InterfaceType{nil}

func (*InterfaceType) Declaration

func (it *InterfaceType) Declaration(pm map[string]string, pkgOverride string) string

func (*InterfaceType) String

func (it *InterfaceType) String(pm map[string]string, pkgOverride string) string

type MapType

type MapType struct {
	Key, Value Type
}

MapType is a map type.

func (*MapType) String

func (mt *MapType) String(pm map[string]string, pkgOverride string) string

type Method

type Method struct {
	Name string
	Type *FuncType
}

Method is a method

func (*Method) Declaration

func (m *Method) Declaration(pm map[string]string, pkgOverride string) string

func (*Method) InterfaceString

func (m *Method) InterfaceString(pm map[string]string, pkgOverride string) string

returns the string representation of this method that would be used to declare it in an interface declaration

type NamedType

type NamedType struct {
	Package    string // may be empty
	Name       string
	Underlying Type

	Methods []*Method
}

NamedType is an exported type in a package.

func (*NamedType) Declaration

func (nt *NamedType) Declaration(pm map[string]string, pkgOverride string) string

func (*NamedType) String

func (nt *NamedType) String(pm map[string]string, pkgOverride string) string

type Package

type Package struct {
	Name        string
	PkgPath     string
	UseExtTypes bool
	Exports     map[string]Export
	NamedTypes  map[string]Type
}

Package is a Go package. It may be a subset.

func NewPackage

func NewPackage(pkgpath string, useExtTypes bool) *Package

func (*Package) AddType

func (pkg *Package) AddType(name string, typ reflect.Type) error

func (*Package) AddValue

func (pkg *Package) AddValue(name string, val reflect.Value) error

func (*Package) Imports

func (pkg *Package) Imports() map[string]bool

Imports returns the imports needed by the Package as a set of import paths.

func (*Package) String

func (pkg *Package) String() string

type PackedPkg

type PackedPkg struct {
	Name    string
	PkgPath string
	Body    string
}

func PackPkg

func PackPkg(pkg *Package) *PackedPkg

type Parameter

type Parameter struct {
	Name string // may be empty
	Type Type
}

Parameter is an argument or return parameter of a method.

func (*Parameter) String

func (p *Parameter) String(pm map[string]string, pkgOverride string) string

type PointerType

type PointerType struct {
	Type Type
}

PointerType is a pointer to another type.

func (*PointerType) String

func (pt *PointerType) String(pm map[string]string, pkgOverride string) string

type PredeclaredType

type PredeclaredType string

PredeclaredType is a predeclared type such as "int".

func (PredeclaredType) String

func (pt PredeclaredType) String(map[string]string, string) string

type StructType

type StructType struct {
	Fields []*Field
}

StructType is a struct type.

func (*StructType) String

func (st *StructType) String(pm map[string]string, pkgOverride string) string

type Type

type Type interface {
	String(pm map[string]string, pkgOverride string) string
	// contains filtered or unexported methods
}

Type is a Go type.

type Variable

type Variable struct {
	Name string
	Type Type
}

func (*Variable) Declaration

func (v *Variable) Declaration(pm map[string]string, pkgOverride string) string

Jump to

Keyboard shortcuts

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