parser

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	ProxyTypeName  string
	AnnotationName string
	MethodName     string
}

type Annotations

type Annotations []Annotation

func (Annotations) Exist

func (a Annotations) Exist(annotation string) bool

type Generator

type Generator struct {
}

func NewGenerator

func NewGenerator() Generator

func (*Generator) GenerateProxy

func (g *Generator) GenerateProxy(outFilePath string, tmpl Template) error

func (*Generator) GenerateTxMiddleware

func (g *Generator) GenerateTxMiddleware(outFilePath string, tmpl Template) error

func (*Generator) Parse

func (g *Generator) Parse(param ParseParam) (Template, error)

type Import

type Import struct {
	Alias string
	Path  string
}

func ParseImportPackage

func ParseImportPackage(node *ast.File) ([]Import, error)

type Interface

type Interface struct {
	ProxyTypeName     string
	InterfaceName     string
	InterfacePackage  string
	IsDiffrentPackage bool
	Methods           Methods
	AllAnnotations    Annotations
	// contains filtered or unexported fields
}

func ParseInterface

func ParseInterface(node *ast.File, isDiffrentPackage bool) ([]Interface, error)

type Interfaces

type Interfaces []Interface

func (Interfaces) Names

func (i Interfaces) Names() []string

type Method

type Method struct {
	ProxyTypeName               string
	Name                        string
	Annotations                 Annotations
	Params                      string
	ParamNames                  string
	ParamNamesWithHelperContext string
	UserContextParam            string
	HelperContextParam          string
	ResultVars                  string
	ResultTypes                 string
	Results                     Results
	HasResults                  bool
	UseProxy                    bool
	HasError                    bool
	HasContext                  bool
}

type Methods

type Methods []Method

func (Methods) AllAnnotations

func (m Methods) AllAnnotations() Annotations

type Param

type Param struct {
	Type       string
	Var        string
	HasContext bool
}

func (Param) Format

func (p Param) Format() string

type Params

type Params []Param

func (Params) Format

func (p Params) Format() string

func (Params) FormatVars

func (p Params) FormatVars(useHelperContext bool) string

func (Params) HasContext

func (p Params) HasContext() bool

type ParseParam

type ParseParam struct {
	TargetFile           string
	TargetFileDir        string
	OutFile              string
	ProxyPackageName     string
	InterfacePackageName string
	InterfacePackagePath string
}

type Result

type Result struct {
	ResultType string
	ResultVar  string
}

type Results

type Results []Result

func (Results) FormatType

func (r Results) FormatType() string

func (Results) FormatVars

func (r Results) FormatVars() string

func (Results) HasError

func (r Results) HasError() bool

type Template

type Template struct {
	FileName string
	FilePath string
	Data     *TemplateData
}

type TemplateData

type TemplateData struct {
	SourceFile  string
	PackageName string
	Imports     []Import
	Interfaces  Interfaces
}

Jump to

Keyboard shortcuts

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