parser

package
v0.0.0-...-7953320 Latest Latest
Warning

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

Go to latest
Published: May 28, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Enum

type Enum struct {
	Name          string
	QuotedComment string
	Values        []*EnumValue

	TypeName   TypeName
	Descriptor *proto.Enum
	// contains filtered or unexported fields
}

func (Enum) File

func (e Enum) File() *File

func (Enum) GetFullName

func (e Enum) GetFullName() string

func (Enum) Kind

func (e Enum) Kind() TypeKind

func (Enum) String

func (e Enum) String() string

type EnumValue

type EnumValue struct {
	Name          string
	Value         int
	QuotedComment string
}

type Field

type Field interface {
	GetName() string
	GetType() Type
	IsRepeated() bool
}

type File

type File struct {
	GoPackage string
	FilePath  string

	PkgName     string
	Services    map[string]*Service
	Messages    []*Message
	Enums       []*Enum
	Imports     []*File
	Descriptors map[string]Type
	// contains filtered or unexported fields
}

type Map

type Map struct {
	Message   *Message
	KeyType   Type
	ValueType Type
	Field     *proto.MapField
	// contains filtered or unexported fields
}

func (Map) File

func (m Map) File() *File

func (Map) Kind

func (m Map) Kind() TypeKind

func (Map) String

func (m Map) String() string

type MapField

type MapField struct {
	Name          string
	QuotedComment string

	Map *Map
	// contains filtered or unexported fields
}

func (*MapField) GetName

func (n *MapField) GetName() string

func (*MapField) GetType

func (n *MapField) GetType() Type

func (*MapField) IsRepeated

func (n *MapField) IsRepeated() bool

type Message

type Message struct {
	Name          string
	QuotedComment string
	NormalFields  []*NormalField
	MapFields     []*MapField
	OneOffs       []*OneOf
	Descriptor    *proto.Message
	TypeName      TypeName
	// contains filtered or unexported fields
}

func (Message) File

func (m Message) File() *File

func (Message) GetFieldByName

func (m Message) GetFieldByName(name string) (Field, bool)

func (Message) GetFields

func (m Message) GetFields() []Field

func (Message) GetFullName

func (m Message) GetFullName() string

func (Message) HaveFields

func (m Message) HaveFields() bool

func (Message) HaveFieldsExcept

func (m Message) HaveFieldsExcept(field string) bool

func (Message) Kind

func (m Message) Kind() TypeKind

func (Message) String

func (m Message) String() string

type Messages

type Messages []*Message

func (Messages) Contains

func (m Messages) Contains(msg *Message) bool

func (Messages) Copy

func (m Messages) Copy() Messages

type Method

type Method struct {
	Name          string
	QuotedComment string
	InputMessage  *Message
	OutputMessage *Message
	Service       *Service
}

type NormalField

type NormalField struct {
	Name          string
	QuotedComment string
	Repeated      bool

	Type     Type
	Optional bool
	Required bool
	OneOf    *OneOf
	// contains filtered or unexported fields
}

func (*NormalField) GetName

func (n *NormalField) GetName() string

func (*NormalField) GetType

func (n *NormalField) GetType() Type

func (*NormalField) IsRepeated

func (n *NormalField) IsRepeated() bool

type OneOf

type OneOf struct {
	Name   string
	Fields []*NormalField
}

type Parser

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

func (*Parser) Parse

func (p *Parser) Parse(path string, importAliases []map[string]string, paths []string) (*File, error)

func (*Parser) ParsedFiles

func (p *Parser) ParsedFiles() []*File

type Scalar

type Scalar struct {
	ScalarName string
	// contains filtered or unexported fields
}

func (Scalar) File

func (s Scalar) File() *File

func (Scalar) Kind

func (s Scalar) Kind() TypeKind

func (Scalar) String

func (s Scalar) String() string

type Service

type Service struct {
	Name          string
	QuotedComment string
	Methods       map[string]*Method
}

type Type

type Type interface {
	String() string
	Kind() TypeKind
	File() *File
}

type TypeKind

type TypeKind byte
const (
	TypeUndefined TypeKind = iota
	TypeScalar
	TypeMessage
	TypeEnum
	TypeMap
)

type TypeName

type TypeName []string

func (TypeName) Equal

func (t TypeName) Equal(t2 TypeName) bool

func (TypeName) NewSubTypeName

func (t TypeName) NewSubTypeName(subName string) TypeName

Jump to

Keyboard shortcuts

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