parser

package
v0.0.0-...-0bfb5ad Latest Latest
Warning

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

Go to latest
Published: Jun 23, 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 Annotation

type Annotation struct {
	Key    string
	Values []string
}

func (*Annotation) GetKey

func (p *Annotation) GetKey() (v string)

func (*Annotation) GetValues

func (p *Annotation) GetValues() (v []string)

func (*Annotation) String

func (p *Annotation) String() string

type Annotations

type Annotations []*Annotation

func (*Annotations) Append

func (a *Annotations) Append(key, value string)

Append append key value pair to Annotation slice.

func (*Annotations) Get

func (a *Annotations) Get(key string) []string

Get return annotations values.

func (*Annotations) GetFirstValue

func (a *Annotations) GetFirstValue(key string) string

func (*Annotations) ILocValueByKey

func (a *Annotations) ILocValueByKey(key string, idx int) string

ILocValueByKey return annotation value by key and index.

type File

type File struct {
	Package *Package `json:"-"`

	//FilePath    string
	//FilePackage string
	IDLPath string

	Services []*Service

	Deps map[string]string // import path -> alias

	FileDescriptor interface{}
}

func (*File) Filename

func (f *File) Filename() string

func (*File) ReferenceName

func (f *File) ReferenceName() string

type Method

type Method struct {
	Service *Service `json:"-"`

	Name                   string
	RawName                string
	Oneway                 bool
	Void                   bool
	Args                   []*Parameter
	ArgsLength             int
	Resp                   *Parameter
	Exceptions             []*Parameter
	ArgStructName          string
	ResStructName          string
	IsResponseNeedRedirect bool // int -> int*
	GenArgResultStruct     bool
	ClientStreaming        bool
	ServerStreaming        bool
	Streaming              *streaming.Streaming

	Annotations Annotations

	Deps map[string]string // import path -> alias
}

type Options

type Options interface {
	NewParser() (Parser, error)
}

type Package

type Package struct {
	ImportPackage string
	ImportPath    string

	Namespace string

	Files []*File

	Deps map[string]string // import path -> alias
}

type Packages

type Packages []*Package

func (Packages) Files

func (p Packages) Files() []*File

func (Packages) Methods

func (p Packages) Methods() []*Method

func (Packages) Services

func (p Packages) Services() []*Service

type Parameter

type Parameter struct {
	Deps    []PkgInfo
	Name    string
	RawName string
	Type    string // *PkgA.StructB
}

Parameter .

type Parser

type Parser interface {
	Parse(files ...string) ([]*Package, error)
}

type PkgInfo

type PkgInfo struct {
	PkgName    string // PkgA
	Alias      string // A
	ImportPath string
}

type Service

type Service struct {
	File *File `json:"-"`

	ServiceName    string
	RawServiceName string
	//ServiceTypeName       func() string `json:"-"`
	Methods               []*Method
	HasStreaming          bool
	ServiceFilePath       string
	Protocol              string
	HandlerReturnKeepResp bool
	UseThriftReflection   bool

	Annotations Annotations

	Deps map[string]string // import path -> alias
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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