method

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Method

type Method struct {
	Name                  string
	HasContext            bool
	ReturnsError          bool
	HasVariadic           bool
	ParameterNames        []string
	ParametersNameAndType []jen.Code
	ReturnTypes           []jen.Code
	ContextParameter      *int
	ReturnErrorIndex      *int
}

Method holds all of the data for code generation on a specific method signature

func MustParseMethod

func MustParseMethod(name string, signature *types.Signature) *Method

MustParseMethod parses the given types.Signature and generates a Method, if there's an error this method will panic

func ParseMethod

func ParseMethod(name string, signature *types.Signature) (*Method, error)

ParseMethod parses the given types.Signature and generates a Method

func (*Method) ConstantRef

func (m *Method) ConstantRef(parentTypeName string) jen.Code

ConstantRef is the reference to the constant for this method's name

func (*Method) ContextParam

func (m *Method) ContextParam() (ctxParamName string, ctxParam jen.Code)

ContextParam generates the param name and type for a context arg for the given method

func (*Method) Parameters

func (m *Method) Parameters() []jen.Code

Parameters generates code for parameter names to be used in codegen

Jump to

Keyboard shortcuts

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