parser

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: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkflowType = WorkerType("workflow")
	ActivityType = WorkerType("activity")
)

Variables

This section is empty.

Functions

func ExperimentalParse

func ExperimentalParse(opts ExperimentalParseOpts) (pkgList map[PackagePath]*Package, err error)

Types

type Endpoint

type Endpoint struct {
	*TypeMeta
	Name       string
	Path       string
	Raw        bool
	Tags       []string
	Methods    []string
	Request    *Var
	Response   *Var
	Directives decorators.List
	Public     bool
}

type ExperimentalParseOpts

type ExperimentalParseOpts struct {
	Dir      string
	Patterns []string
	Logger   *slog.Logger
}

type FuncDecl

type FuncDecl struct {
	*ast.FuncDecl
	Directives decorators.List
}

type Method

type Method struct {
	*TypeMeta
	Name       string
	Directives decorators.List
	Request    *Var
	Response   *Var
}

type Middleware

type Middleware struct {
	*TypeMeta
	Name       string
	Tags       []string
	Order      int
	Directives decorators.List
}

type Package

type Package struct {
	Name       string
	Path       PackagePath
	GoPackage  *packages.Package
	Services   map[*ast.Ident]*Service
	Workers    map[*ast.Ident]*Worker
	Providers  map[*ast.Ident]*Provider
	Middleware map[*ast.Ident]*Middleware
	// contains filtered or unexported fields
}

func NewPackage

func NewPackage(p *packages.Package, dir string) *Package

type PackagePath

type PackagePath string

func (PackagePath) String

func (p PackagePath) String() string

type Provider

type Provider struct {
	*TypeMeta
	Name       string
	Type       ProviderType
	Directives decorators.List
}

type ProviderType

type ProviderType string
var (
	StructProviderType   ProviderType = "struct"
	FunctionProviderType ProviderType = "function"
)

type Service

type Service struct {
	*TypeMeta
	Name       string
	Directives decorators.List
	Endpoints  map[*ast.Ident]*Endpoint
}

func NewService

func NewService(name string, meta *TypeMeta) *Service

type TypeMeta

type TypeMeta struct {
	Ident   *ast.Ident
	Object  types.Object
	Package *Package
}

func NewTypeMeta

func NewTypeMeta(
	ident *ast.Ident,
	obj types.Object,
	pkg *Package,
) *TypeMeta

func (TypeMeta) File

func (t TypeMeta) File() *token.File

func (TypeMeta) ID

func (t TypeMeta) ID() string

func (TypeMeta) PackagePath

func (t TypeMeta) PackagePath() string

func (TypeMeta) Pos

func (t TypeMeta) Pos() token.Pos

func (TypeMeta) Position

func (t TypeMeta) Position() token.Position

func (TypeMeta) QualifiedName

func (t TypeMeta) QualifiedName() string

QualifiedName returns the qualified name of the object. If the object is a method, the receiver type is prepended to the name. MyType.Name is the qualified name. where MyType is a receiver of the method Name.

func (TypeMeta) Recv

func (t TypeMeta) Recv() *types.Var

Recv returns the receiver of a method, or nil if the object is not a method.

func (TypeMeta) RecvNamed

func (t TypeMeta) RecvNamed() *types.Named

type Var

type Var struct {
	*types.Var
}

func (*Var) IsSlice

func (v *Var) IsSlice() bool

func (*Var) IsStruct

func (v *Var) IsStruct() bool

func (*Var) TypeName

func (v *Var) TypeName() string

func (*Var) TypePkgPath

func (v *Var) TypePkgPath() string

type Worker

type Worker struct {
	*TypeMeta
	Name       string
	Type       WorkerType
	TaskQueue  string
	Methods    map[*ast.Ident]*Method
	Directives decorators.List
}

func NewWorker

func NewWorker(name, queue string, meta *TypeMeta) *Worker

type WorkerType

type WorkerType string

Jump to

Keyboard shortcuts

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