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: 3 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 ClientMethod

type ClientMethod struct {
	*HttpMethod
	BodyParamsCode   string
	QueryParamsCode  string
	PathParamsCode   string
	HeaderParamsCode string
	FormValueCode    string
	FormFileCode     string
}

type File

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

	IDLPath string

	Services []*Service

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

	FileDescriptor interface{} // parsed file descriptor from IDL, such as desc.FileDescriptor Or parser.Thrift
}

func (*File) Filename

func (f *File) Filename() string

func (*File) ReferenceName

func (f *File) ReferenceName() string

type HttpMethod

type HttpMethod struct {
	Name               string
	HTTPMethod         string
	Comment            string
	RequestArgName     string
	RequestTypeName    string
	RequestTypePackage string
	RequestTypeRawName string
	ReturnTypeName     string
	ReturnTypePackage  string
	ReturnTypeRawName  string
	Path               string
	Serializer         string

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

	Annotations Annotations

	Service *Service `json:"-"`
}

type Options

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

type Package

type Package struct {
	ImportPackage string
	ImportPath    string

	Namespace string

	Files []*File
}

type Packages

type Packages []*Package

func (Packages) Files

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

func (Packages) Methods

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

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) (Packages, error)
}

type PkgInfo

type PkgInfo struct {
	PkgName    string // PkgA
	PkgRefName string // PkgA
	ImportPath string
}

type Service

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

	Name          string
	Comment       string
	Methods       []*HttpMethod
	ClientMethods []*ClientMethod
	BaseDomain    string // base domain for client code
	ServiceGroup  string // service level router group

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

	Annotations Annotations
}

func (*Service) GetClientMethod

func (s *Service) GetClientMethod(name string) *ClientMethod

func (*Service) GetMethod

func (s *Service) GetMethod(name string) *HttpMethod

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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