Documentation ¶
Overview ¶
Package gocode defines basic structs used by IRNodes to describe Golang types, variables, funcs, constructors, and service interfaces.
Index ¶
- func IsBasicType(name string) bool
- func IsBuiltinPackage(packageName string) bool
- func NameOf[T any]() string
- type AnyType
- type BasicType
- type Chan
- type Constructor
- type Ellipsis
- type Func
- type FuncType
- type GenericType
- type GenericTypeParam
- type InterfaceType
- type Map
- type Pointer
- type ReceiveChan
- type SendChan
- type ServiceInterface
- type Slice
- type StructType
- type TypeName
- type UserType
- type Variable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBasicType ¶
Reports whether name is a basic type (e.g. "bool", "string", "int32", "float32", "rune", etc.)
func IsBuiltinPackage ¶
Reports whether packageName is a builtin (e.g. "os", "context")
Types ¶
type AnyType ¶
type AnyType struct {
TypeName
}
The 'any' type which is just interface{}
func (*AnyType) IsTypeName ¶
func (t *AnyType) IsTypeName()
type BasicType ¶
Primitive types that don't need import statements
func (*BasicType) IsTypeName ¶
func (t *BasicType) IsTypeName()
type Chan ¶
Bidirectional Channel, e.g. chan string, chan *MyType
func (*Chan) IsTypeName ¶
func (t *Chan) IsTypeName()
type Constructor ¶
type Ellipsis ¶
Ellipsis type used in function arguments, e.g. ...string
func (*Ellipsis) IsTypeName ¶
func (t *Ellipsis) IsTypeName()
type FuncType ¶
type FuncType struct {
TypeName
}
A function signature. For now Blueprint doesn't support functions in service method declarations, so we don't bother unravelling and representing the function declaration here
func (*FuncType) IsTypeName ¶
func (t *FuncType) IsTypeName()
type GenericType ¶
A struct with generics. For now blueprint doesn't support generics in service declarations
func (*GenericType) Equals ¶
func (t *GenericType) Equals(other TypeName) bool
func (*GenericType) IsTypeName ¶
func (t *GenericType) IsTypeName()
func (*GenericType) String ¶
func (t *GenericType) String() string
type GenericTypeParam ¶
The type parameter of a generic struct or func
func (*GenericTypeParam) Equals ¶
func (t *GenericTypeParam) Equals(other TypeName) bool
func (*GenericTypeParam) IsTypeName ¶
func (t *GenericTypeParam) IsTypeName()
func (*GenericTypeParam) String ¶
func (t *GenericTypeParam) String() string
type InterfaceType ¶
type InterfaceType struct {
TypeName
}
An interface of any kind. For now Blueprint doesn't support interfaces in service method declarations, so we don't bother unravelling and representing the interface declaration here
func (*InterfaceType) Equals ¶
func (t *InterfaceType) Equals(other TypeName) bool
func (*InterfaceType) IsTypeName ¶
func (t *InterfaceType) IsTypeName()
func (*InterfaceType) String ¶
func (t *InterfaceType) String() string
type Map ¶
Map type, e.g. map[string]context.Context
func (*Map) IsTypeName ¶
func (t *Map) IsTypeName()
type Pointer ¶
Pointer to a type, e.g. *string, *MyType, *context.Context
func (*Pointer) IsTypeName ¶
func (t *Pointer) IsTypeName()
type ReceiveChan ¶
Receive-only Channel, e.g. <-chan string, <-chan *MyType
func (*ReceiveChan) Equals ¶
func (t *ReceiveChan) Equals(other TypeName) bool
func (*ReceiveChan) IsTypeName ¶
func (t *ReceiveChan) IsTypeName()
func (*ReceiveChan) String ¶
func (t *ReceiveChan) String() string
type SendChan ¶
Send-only Channel, e.g. chan<- string, chan<- *MyType
func (*SendChan) IsTypeName ¶
func (t *SendChan) IsTypeName()
type ServiceInterface ¶
type ServiceInterface struct { UserType // Has a Name and a Source location BaseName string Methods map[string]Func }
Implements service.ServiceInterface
func CopyServiceInterface ¶
func CopyServiceInterface(name string, pkg string, s *ServiceInterface) *ServiceInterface
func (*ServiceInterface) AddMethod ¶
func (s *ServiceInterface) AddMethod(f Func)
func (*ServiceInterface) Contains ¶
func (i *ServiceInterface) Contains(j *ServiceInterface) bool
Reports whether all of the methods in j exist on interface i
func (*ServiceInterface) GetMethods ¶
func (s *ServiceInterface) GetMethods() []service.Method
func (*ServiceInterface) GetName ¶
func (s *ServiceInterface) GetName() string
func (*ServiceInterface) String ¶
func (i *ServiceInterface) String() string
type Slice ¶
A slice or fixed-size array, e.g. []byte
func (*Slice) IsTypeName ¶
func (t *Slice) IsTypeName()
type StructType ¶
type StructType struct {
TypeName
}
An inline struct of any kind. For now Blueprint doesn't support inline structs in service method declarations, so we don't bother unravelling and representing the struct here
func (*StructType) Equals ¶
func (t *StructType) Equals(other TypeName) bool
func (*StructType) IsTypeName ¶
func (t *StructType) IsTypeName()
func (*StructType) String ¶
func (t *StructType) String() string
type TypeName ¶
A type name is the fully qualified name of a type that you use when declaring a variable, including possible imports and go.mod requires
type UserType ¶
A type that is declared in a module, thus requiring an import statement and a go.mod requires statement
func (*UserType) IsTypeName ¶
func (t *UserType) IsTypeName()