models

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StructConstructor

type StructConstructor struct {
	// contains filtered or unexported fields
}

func NewStructConstructor

func NewStructConstructor(funcDec *ast.FuncDecl) (StructConstructor, bool)

func (StructConstructor) GetConstructor

func (sc StructConstructor) GetConstructor() *ast.FuncDecl

func (StructConstructor) GetStructReturn

func (sc StructConstructor) GetStructReturn() *ast.Ident

GetStructReturn Return the struct linked to this "constructor".

type StructHolder

type StructHolder struct {
	// The features to be analyzed
	Features features.Feature

	// The struct declaration
	Struct *ast.TypeSpec

	// A Struct constructor is considered if starts with `New...` and the 1st output parameter is a struct
	Constructors []*ast.FuncDecl

	// Struct methods
	StructMethods []*ast.FuncDecl
}

StructHolder contains all the information around a Go struct.

func (*StructHolder) AddConstructor

func (sh *StructHolder) AddConstructor(fn *ast.FuncDecl)

func (*StructHolder) AddMethod

func (sh *StructHolder) AddMethod(fn *ast.FuncDecl)

func (*StructHolder) Analyze

func (sh *StructHolder) Analyze() []analysis.Diagnostic

Jump to

Keyboard shortcuts

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