Documentation
¶
Index ¶
- type Expression
- type Field
- type Function
- func (f *Function) FullName() string
- func (f *Function) IsNaked() bool
- func (f *Function) OnlyReturnsError() bool
- func (f *Function) OnlyReturnsOneValue() bool
- func (f *Function) ReturnsMultiple() bool
- func (f *Function) TestName() string
- func (f *Function) TestParameters() []*Field
- func (f *Function) TestResults() []*Field
- type Header
- type Import
- type Path
- type Receiver
- type TypeParam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expression ¶
Expression represents a type expression in Go code, including metadata about pointers, variadic parameters, and writers.
func (*Expression) String ¶
func (e *Expression) String() string
String returns the string representation of the expression, including pointer and variadic prefixes.
type Field ¶
type Field struct {
Name string
Type *Expression
Index int
}
Field represents a parameter, result, or struct field in a function or method signature.
func (*Field) IsBasicType ¶
IsBasicType returns true if the field is a Go basic type (bool, string, int, etc.).
type Function ¶
type Function struct {
Name string
IsExported bool
Receiver *Receiver
Parameters []*Field
Results []*Field
ReturnsError bool
TypeParams []*TypeParam // Type parameters for generic functions
Body string // Source code of the function body for AI context
}
Function represents a function or method signature with its parameters, results, and metadata.
func (*Function) FullName ¶
FullName returns the full name of the function, including the receiver type if it's a method.
func (*Function) IsNaked ¶
IsNaked returns true if the function has no receiver, parameters, or results.
func (*Function) OnlyReturnsError ¶
OnlyReturnsError returns true if the function returns only an error.
func (*Function) OnlyReturnsOneValue ¶
OnlyReturnsOneValue returns true if the function returns exactly one non-error value.
func (*Function) ReturnsMultiple ¶
ReturnsMultiple returns true if the function returns more than one value.
func (*Function) TestParameters ¶
TestParameters returns the function's parameters excluding io.Writer parameters.
func (*Function) TestResults ¶
TestResults returns the function's results plus any io.Writer parameters converted to string results.
type Header ¶
Header represents the header of a Go file, including package name, imports, and any code between imports and declarations.
type Import ¶
type Import struct {
Name, Path string
}
Import represents an import statement with an optional name and the import path.
type Path ¶
type Path string
Path represents a file system path.
func (Path) IsTestPath ¶
IsTestPath returns true if the path is a test file path (ends with _test.go).