modspecv2

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GatherResults

func GatherResults[T any](results []*analysis.Pass) (resultsMap []T)

func GenGoExt

func GenGoExt(name string) string

func MultiLineCurly

func MultiLineCurly() jen.Options

func MultiLineParen

func MultiLineParen() jen.Options

func NewJenFileFromPackage

func NewJenFileFromPackage(pkg *types.Package) *jen.File

func RelPathFromPass

func RelPathFromPass(pass *analysis.Pass) string

func SaveArtifacts

func SaveArtifacts(module *packages.Module, artifacts []Artifact) ([]string, error)

SaveArtifacts saves the artifacts to disk relative to the module directory

Types

type Artifact

type Artifact interface {
	// File returns a generated jen.File that will be written to disk
	File() *jen.File

	// OutputPath returns a string to a file and its extension relative to the module root
	// i.e., example.com/foo/bar/baz.go -> foo/bar/baz.gen.go
	OutputPath() string
}

type Operation

type Operation struct {
	Name       string
	Params     []Type
	Results    []Type
	Method     *ast.Field
	Doc        string
	Decorators decorators.List
}

type Package

type Package struct {
	Name     string
	Services []*Service
	GoPkg    *types.Package
	GoModule *analysis.Module
}

type PackageArtifact

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

func NewPackageArtifact

func NewPackageArtifact(file *jen.File, pass *analysis.Pass, ext string) *PackageArtifact

func (*PackageArtifact) File

func (p *PackageArtifact) File() *jen.File

func (*PackageArtifact) OutputPath

func (p *PackageArtifact) OutputPath() string

type Service

type Service struct {
	Name       string
	Operations []*Operation
	Decorators decorators.List
	Doc        string
	Decl       *ast.GenDecl
	Iface      *ast.InterfaceType
	Tspec      *ast.TypeSpec
}

type Type

type Type struct {
	Name  string
	Field *ast.Field
}

Type represents an abstract type A can be any native Go object, we use this to identify properties or func arguments/results

Jump to

Keyboard shortcuts

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