Documentation ¶
Index ¶
- func CheckOption(bearer OptionsBearer, optName string) *optChecker
- func Equal(x, y Unique) bool
- func FieldIndex(f Field) int
- func FieldName(f Field) string
- func GetFieldKey(k Unique, fieldAddr interface{}) string
- func GetUnique(k Unique) string
- func IsErrorTypeNotFound(err error) bool
- func SamePrimitive(x, y Type) bool
- func SetUnique(k Unique, ctx UniqueContext)
- type Any
- type ArrayOption
- type Bool
- type BoolOption
- type Bytes
- type Comment
- type Commented
- type Compound
- type EmbeddedOption
- type Enum
- type EnumOption
- type EnumValue
- type ErrorPackageMissingFiles
- type ErrorTypeNotFound
- type Extension
- type ExtensionField
- type Field
- type File
- type FileManager
- type Fixed32
- type Fixed64
- type Float32
- type Float64
- type FloatOption
- type Hashable
- type Import
- type Int32
- type Int64
- type IntOption
- type Map
- type MapOption
- type Message
- func (m *Message) AllFields() []Field
- func (m *Message) Enum(name string) (*Enum, error)
- func (m *Message) Field(name string) *MessageField
- func (m *Message) FieldOneof(name string) Field
- func (m *Message) GetComment() *Comment
- func (m *Message) GetFullName() string
- func (m *Message) GetName() string
- func (m *Message) GetOptions() []*Option
- func (m *Message) GetParentMsg() *Message
- func (m *Message) Message(name string) (*Message, error)
- func (m *Message) ScanTypes(inspector func(typ Type) bool)
- func (m *Message) String() string
- func (m *Message) Type(name string) Type
- type MessageField
- type Method
- type MethodType
- type Named
- type Node
- type OneOf
- type OneOfBranch
- type Option
- type OptionValue
- type Optional
- type OptionsBearer
- type Package
- func (s *Package) Enum(name string) (*Enum, error)
- func (s *Package) File(name string) (*File, error)
- func (s *Package) Files() []*File
- func (s *Package) GoPkg() string
- func (s *Package) Message(name string) (*Message, error)
- func (s *Package) Pkg() string
- func (s *Package) ScanTypes(inspector func(p Type) bool)
- func (s *Package) Service(name string) *Service
- func (s *Package) Services() []*Service
- func (s *Package) Type(name string) Type
- func (s *Package) Types() []Type
- type Printer
- type Repeated
- type ScalarNode
- type Service
- type Sfixed32
- type Sfixed64
- type Sint32
- type Sint64
- type Stream
- type String
- type StringOption
- type Type
- type Uint32
- type Uint64
- type UintOption
- type Unique
- type UniqueContext
- type Valuable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckOption ¶ added in v0.30.1
func CheckOption(bearer OptionsBearer, optName string) *optChecker
func GetFieldKey ¶
GetFieldKey получает ключ для поля данного k
func IsErrorTypeNotFound ¶
IsErrorTypeNotFound проверка, что данная ошибка является обёрткой для ErrorTypeNotFound
func SamePrimitive ¶
SamePrimitive проверка равенства примитивных типов
func SetUnique ¶
func SetUnique(k Unique, ctx UniqueContext)
SetUnique устанавливает уникальное в рамках UniqueContext значение для данного Unique
Types ¶
type Any ¶
type Any struct { File *File // contains filtered or unexported fields }
Any представление типа golang.protobuf.Any
func (*Any) GetFullName ¶ added in v0.30.3
type ArrayOption ¶
type ArrayOption struct { Value []OptionValue // contains filtered or unexported fields }
ArrayOption branch of OptionValue
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
Bool представление булевского типа
func (*Bool) GetFullName ¶ added in v0.30.3
type BoolOption ¶
type BoolOption struct { Value bool // contains filtered or unexported fields }
BoolOption branch of OptionValue
func (*BoolOption) GetValue ¶ added in v0.30.2
func (o *BoolOption) GetValue() interface{}
func (*BoolOption) String ¶
func (o *BoolOption) String() string
type Bytes ¶
type Bytes struct {
// contains filtered or unexported fields
}
Bytes представление типа bytes
func (*Bytes) GetFullName ¶ added in v0.30.3
type EmbeddedOption ¶
type EmbeddedOption struct { Value string // contains filtered or unexported fields }
EmbeddedOption представление встроенной опции
func (*EmbeddedOption) GetValue ¶ added in v0.30.1
func (o *EmbeddedOption) GetValue() interface{}
type Enum ¶
type Enum struct { File *File ParentMsg *Message Name string Comment *Comment Options []*Option Values []*EnumValue // contains filtered or unexported fields }
Enum представление типа enum
func (*Enum) GetComment ¶ added in v0.30.1
func (*Enum) GetFullName ¶ added in v0.30.3
type EnumOption ¶
type EnumOption struct { Value *EnumValue // contains filtered or unexported fields }
EnumOption представление опций типа Enum
func (*EnumOption) GetValue ¶ added in v0.30.1
func (o *EnumOption) GetValue() interface{}
type EnumValue ¶
type EnumValue struct { Name string Comment *Comment Integer int Options []*Option // contains filtered or unexported fields }
EnumValue представление поля для Enum-а
func (*EnumValue) GetComment ¶ added in v0.30.1
func (*EnumValue) GetFullName ¶ added in v0.30.3
type ErrorPackageMissingFiles ¶
type ErrorPackageMissingFiles struct{}
ErrorPackageMissingFiles ошибка указывающая на отсутствие proto-файлов в пакете
func (ErrorPackageMissingFiles) Error ¶
func (ErrorPackageMissingFiles) Error() string
type ErrorTypeNotFound ¶
type ErrorTypeNotFound string
ErrorTypeNotFound ошибка возвращаемая если тип не был найден
func (ErrorTypeNotFound) Error ¶
func (e ErrorTypeNotFound) Error() string
type Extension ¶
type Extension struct { File *File ParentMsg *Message Name string Fields []*ExtensionField Types []Type // contains filtered or unexported fields }
Extension представление extension
func MessageToExtension ¶
MessageToExtension копирует Message в Extension с сохранением всей информации
type ExtensionField ¶
type ExtensionField struct { Name string Sequence int Type Type Options []*Option // contains filtered or unexported fields }
ExtensionField представление поля extension-а
type Field ¶
type Field interface { Unique Named Commented OptionsBearer // contains filtered or unexported methods }
Field представление сущности являющейся полем сообщения. Это может быть как непосредственно поле, так и ветвь oneof-а
type File ¶
type File struct { Name string Package string Syntax string Imports []*Import Types []Type Extensions []*Extension Services []*Service Options []*Option GoPath string GoPkg string // contains filtered or unexported fields }
File представление для файла
func (*File) Enum ¶
Enum поиск перечисления по имени Возвращает ошибку ErrorTypeNotFound если такой тип с таким именем не найден.
func (*File) GetOptions ¶ added in v0.30.1
func (*File) Message ¶
Message поиск структуры по имени. Возвращает ошибку ErrorTypeNotFound если такой тип с таким именем не найден.
type FileManager ¶
type FileManager interface { // Create возвращаем пару writer и функцию закрытия файла вместо одного io.WriteClose для удобства в тестах // Плюс, этот интерфейс будет использоваться только внутри приложения Create(name string) (writer io.Writer, closer func() error, err error) }
FileManager работа с записываемыми файлами
func NewFileManager ¶
func NewFileManager(root string) FileManager
NewFileManager реализация управления файлами на уровне файловой системы
type Fixed32 ¶
type Fixed32 struct {
// contains filtered or unexported fields
}
Fixed32 представление типа fixed32
func (*Fixed32) GetFullName ¶ added in v0.30.3
type Fixed64 ¶
type Fixed64 struct {
// contains filtered or unexported fields
}
Fixed64 представление типа fixed64
func (*Fixed64) GetFullName ¶ added in v0.30.3
type Float32 ¶
type Float32 struct {
// contains filtered or unexported fields
}
Float32 представление типа float
func (*Float32) GetFullName ¶ added in v0.30.3
type Float64 ¶
type Float64 struct {
// contains filtered or unexported fields
}
Float64 представление типа double
func (*Float64) GetFullName ¶ added in v0.30.3
type FloatOption ¶
type FloatOption struct { Value float64 // contains filtered or unexported fields }
FloatOption branch of OptionValue
func (*FloatOption) GetValue ¶ added in v0.30.1
func (o *FloatOption) GetValue() interface{}
func (*FloatOption) String ¶
func (o *FloatOption) String() string
type Hashable ¶
type Hashable interface { ScalarNode // contains filtered or unexported methods }
Hashable типы могущие являться ключами словарей
type Int32 ¶
type Int32 struct {
// contains filtered or unexported fields
}
Int32 представление типа int32
func (*Int32) GetFullName ¶ added in v0.30.3
type Int64 ¶
type Int64 struct {
// contains filtered or unexported fields
}
Int64 представление типа int64
func (*Int64) GetFullName ¶ added in v0.30.3
type IntOption ¶
type IntOption struct { Value int64 // contains filtered or unexported fields }
IntOption branch of OptionValue
type MapOption ¶
type MapOption struct { Value map[string]OptionValue // contains filtered or unexported fields }
MapOption branch of OptionValue
type Message ¶
type Message struct { File *File ParentMsg *Message Name string Comment *Comment Fields []*MessageField Types []Type Options []*Option // contains filtered or unexported fields }
Message представление message
func (*Message) AllFields ¶
AllFields возвращает поля и ветви oneof данного сообщения единым списком
func (*Message) Enum ¶
Enum поиск вложенного перечисления по имени. Возвращает ошибку ErrorTypeNotFound если такой тип с таким именем не найден.
func (*Message) Field ¶
func (m *Message) Field(name string) *MessageField
Field возвращает поле мессаджа по имени. Не производит нормализации по oneof-ам.
func (*Message) FieldOneof ¶
FieldOneof возвращает поле мессаджа по имени, при этом залезает, если нужно, внутрь oneof-а
func (*Message) GetComment ¶ added in v0.30.1
func (*Message) GetFullName ¶ added in v0.30.3
func (*Message) GetOptions ¶ added in v0.30.1
func (*Message) GetParentMsg ¶
func (*Message) Message ¶
Message поиск подструктуры по имени. Возвращает ошибку ErrorTypeNotFound если такой тип с таким именем не найден.
type MessageField ¶
type MessageField struct { Name string Comment *Comment Sequence int Type Type Options []*Option // contains filtered or unexported fields }
MessageField представление поля message-а
func (*MessageField) GetComment ¶ added in v0.30.1
func (m *MessageField) GetComment() *Comment
func (*MessageField) GetFullName ¶ added in v0.30.3
func (m *MessageField) GetFullName() string
func (*MessageField) GetName ¶ added in v0.30.1
func (m *MessageField) GetName() string
func (*MessageField) GetOptions ¶ added in v0.30.1
func (m *MessageField) GetOptions() []*Option
type Method ¶
type Method struct { File *File Service *Service Name string Comment *Comment Input Type Output Type Options []*Option // contains filtered or unexported fields }
Method представление для метода
func (*Method) GetComment ¶ added in v0.30.1
func (*Method) GetFullName ¶ added in v0.30.3
func (*Method) GetMethodType ¶ added in v0.30.4
func (m *Method) GetMethodType() MethodType
GetMethodType возвращает тип метода.
func (*Method) GetOptions ¶ added in v0.30.1
func (*Method) InputMessage ¶
InputMessage возвращает структуру запроса (минуя оборачивающий Stream, если нужно)
func (*Method) OutputMessage ¶
OutputMessage аналогично InputMessage, возвращает структуру ответа, при необходимости снимая stream
type MethodType ¶ added in v0.30.4
type MethodType byte
MethodType тип метода: унарный, входящий/исходящий/двунаправленный потоковый.
const ( Unary MethodType InputStream OutputStream BidirectionalStream )
Типы методов.
type Node ¶
type Node interface { Unique // contains filtered or unexported methods }
Node представление базовой ноды
type OneOf ¶
type OneOf struct { ParentMsg *Message Name string Branches []*OneOfBranch // contains filtered or unexported fields }
OneOf представление для oneof поля message-а
func (*OneOf) GetFullName ¶ added in v0.30.3
func (*OneOf) GetParentMsg ¶
type OneOfBranch ¶
type OneOfBranch struct { Name string Comment *Comment Type Type ParentOO *OneOf Sequence int Options []*Option // contains filtered or unexported fields }
OneOfBranch представление для ветви
func (*OneOfBranch) GetComment ¶ added in v0.30.1
func (o *OneOfBranch) GetComment() *Comment
func (*OneOfBranch) GetFullName ¶ added in v0.30.3
func (o *OneOfBranch) GetFullName() string
func (*OneOfBranch) GetName ¶
func (o *OneOfBranch) GetName() string
func (*OneOfBranch) GetOptions ¶ added in v0.30.1
func (o *OneOfBranch) GetOptions() []*Option
type Option ¶
type Option struct { Name string Value OptionValue Extension *Extension // contains filtered or unexported fields }
Option опция
func (*Option) GetFullName ¶ added in v0.30.3
type OptionValue ¶
type OptionValue interface { Unique // contains filtered or unexported methods }
OptionValue значение опции
type Optional ¶
type Optional struct { Type Type // contains filtered or unexported fields }
Optional представление для опциональных полей
type OptionsBearer ¶ added in v0.30.1
type OptionsBearer interface {
GetOptions() []*Option
}
OptionsBearer типы, которые могут содержать proto-опции.
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
Package представление пакета прото-файлов. Данная структура введена скорее для удобства, т.к. понятия пакет в смысле группа файлов с одинаковым именем package в protobuf нет — файлы не попадают на трансляцию автоматически, а добавляются туда вручную, при трансляции они могут попасть в различные целевые каталоги и т.д.
func NewPackage ¶
NewPackage конструктор пакета прото-файлов. Если список files пуст возвращается ошибка ErrorPackageMissingFiles
func (*Package) Enum ¶
Enum поиск перечисления по имени Возвращает ошибку ast.ErrorTypeNotFound если такой тип с таким именем не найден.
func (*Package) File ¶
File отдать файл с данным именем. Функция path.Split вызванная на имени файла должна возвращать только пустое значение dir.
Правильные названия файлов при вызове: error_codes.proto, marker.proto, atlas Неправильные названия файлов: atlas/atlas.proto, /atlas.proto
func (*Package) Message ¶
Message поиск структуры по имени. Возвращает ошибку ast.ErrorTypeNotFound если такой тип с таким именем не найден.
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer печать файлов
type Repeated ¶
type Repeated struct { Type Type // contains filtered or unexported fields }
Repeated представление для полей с repeeated
type ScalarNode ¶
type ScalarNode interface { Type // contains filtered or unexported methods }
ScalarNode скалярные типы
type Service ¶
type Service struct { File *File Name string Comment *Comment Methods []*Method Options []*Option // contains filtered or unexported fields }
Service представление для сервисов
func (*Service) GetComment ¶ added in v0.30.1
func (*Service) GetFullName ¶ added in v0.30.3
func (*Service) GetOptions ¶ added in v0.30.1
type Sfixed32 ¶
type Sfixed32 struct {
// contains filtered or unexported fields
}
Sfixed32 представление для типа sfixed32
func (*Sfixed32) GetFullName ¶ added in v0.30.3
type Sfixed64 ¶
type Sfixed64 struct {
// contains filtered or unexported fields
}
Sfixed64 представление для типа sfixed64
func (*Sfixed64) GetFullName ¶ added in v0.30.3
type Sint32 ¶
type Sint32 struct {
// contains filtered or unexported fields
}
Sint32 представление для типа sint32
func (*Sint32) GetFullName ¶ added in v0.30.3
type Sint64 ¶
type Sint64 struct {
// contains filtered or unexported fields
}
Sint64 представление типа sint64
func (*Sint64) GetFullName ¶ added in v0.30.3
type Stream ¶
type Stream struct { Type Type // contains filtered or unexported fields }
Stream представление для stream-аргументов и возвращаемых значений метода
type String ¶
type String struct {
// contains filtered or unexported fields
}
String представление для стрового типа
func (*String) GetFullName ¶ added in v0.30.3
type StringOption ¶
type StringOption struct { Value string // contains filtered or unexported fields }
StringOption branch of OptionValue
func (*StringOption) GetValue ¶ added in v0.30.1
func (o *StringOption) GetValue() interface{}
func (*StringOption) String ¶
func (o *StringOption) String() string
type Type ¶
type Type interface { Node // contains filtered or unexported methods }
Type представление типа
type Uint32 ¶
type Uint32 struct {
// contains filtered or unexported fields
}
Uint32 представление для типа uint32
func (*Uint32) GetFullName ¶ added in v0.30.3
type Uint64 ¶
type Uint64 struct {
// contains filtered or unexported fields
}
Uint64 представление для типа uint64
func (*Uint64) GetFullName ¶ added in v0.30.3
type UintOption ¶
type UintOption struct { Value uint64 // contains filtered or unexported fields }
UintOption branch of OptionValue
func (*UintOption) GetValue ¶ added in v0.30.1
func (o *UintOption) GetValue() interface{}
func (*UintOption) String ¶
func (o *UintOption) String() string
type Unique ¶
type Unique interface {
// contains filtered or unexported methods
}
Unique интерфейс для уникализации инстансов в AST привязывающий к данному объекту некое уникальное для контекстного множества значение
type UniqueContext ¶
type UniqueContext map[string]struct{}
UniqueContext контекст для создания уникальных значений
Source Files ¶
- any.go
- ast.go
- bool.go
- bytes.go
- comment.go
- enum.go
- equal.go
- errors.go
- extension.go
- field.go
- file.go
- fixed32.go
- fixed64.go
- float32.go
- float64.go
- import.go
- int32.go
- int64.go
- map.go
- message.go
- method.go
- oneof.go
- option.go
- optional.go
- package.go
- printer.go
- repeated.go
- service.go
- sfixed32.go
- sfixed64.go
- sint32.go
- sint64.go
- stream.go
- string.go
- uint32.go
- uint64.go
- unique.go