2020-06-08 03:29:51 +03:00
|
|
|
package format
|
|
|
|
|
2021-12-02 00:48:25 +03:00
|
|
|
import "github.com/wader/fq/pkg/scalar"
|
2021-11-05 17:04:26 +03:00
|
|
|
|
2020-06-08 03:29:51 +03:00
|
|
|
const (
|
|
|
|
ProtoBufTypeInt32 = iota
|
|
|
|
ProtoBufTypeInt64
|
|
|
|
ProtoBufTypeUInt32
|
|
|
|
ProtoBufTypeUInt64
|
|
|
|
ProtoBufTypeSInt32
|
|
|
|
ProtoBufTypeSInt64
|
|
|
|
ProtoBufTypeBool
|
|
|
|
ProtoBufTypeEnum
|
|
|
|
ProtoBufTypeFixed64
|
|
|
|
ProtoBufTypeSFixed64
|
|
|
|
ProtoBufTypeDouble
|
|
|
|
ProtoBufTypeString
|
|
|
|
ProtoBufTypeBytes
|
|
|
|
ProtoBufTypeMessage
|
|
|
|
ProtoBufTypePackedRepeated
|
|
|
|
ProtoBufTypeFixed32
|
|
|
|
ProtoBufTypeSFixed32
|
|
|
|
ProtoBufTypeFloat
|
|
|
|
)
|
|
|
|
|
2022-09-30 14:58:23 +03:00
|
|
|
var ProtoBufTypeNames = scalar.UintMapSymStr{
|
2023-02-15 13:04:39 +03:00
|
|
|
ProtoBufTypeInt32: "int32",
|
|
|
|
ProtoBufTypeInt64: "int64",
|
|
|
|
ProtoBufTypeUInt32: "uint32",
|
|
|
|
ProtoBufTypeUInt64: "uint64",
|
|
|
|
ProtoBufTypeSInt32: "sint32",
|
|
|
|
ProtoBufTypeSInt64: "sint64",
|
|
|
|
ProtoBufTypeBool: "bool",
|
|
|
|
ProtoBufTypeEnum: "enum",
|
|
|
|
ProtoBufTypeFixed64: "fixed64",
|
|
|
|
ProtoBufTypeSFixed64: "sfixed64",
|
|
|
|
ProtoBufTypeDouble: "double",
|
|
|
|
ProtoBufTypeString: "string",
|
|
|
|
ProtoBufTypeBytes: "bytes",
|
|
|
|
ProtoBufTypeMessage: "message",
|
|
|
|
ProtoBufTypePackedRepeated: "packed_repeated",
|
|
|
|
ProtoBufTypeFixed32: "fixed32",
|
|
|
|
ProtoBufTypeSFixed32: "sfixed32",
|
|
|
|
ProtoBufTypeFloat: "float",
|
2020-06-08 03:29:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
type ProtoBufField struct {
|
|
|
|
Type int
|
|
|
|
Name string
|
|
|
|
Message ProtoBufMessage
|
|
|
|
Enums map[uint64]string
|
|
|
|
}
|
|
|
|
|
|
|
|
type ProtoBufMessage map[int]ProtoBufField
|