class Protobuf::Schema

Defined in:

protobuf/schema.cr:13
protobuf/schema.cr:65
protobuf/schema/field.cr
protobuf/schema/less.cr
protobuf/schema/message.cr
protobuf/schema/parser.cr
protobuf/schema/text.cr

Constant Summary

PB_TYPE_MAP = {"int32" => Int32, "int64" => Int64, "uint32" => UInt32, "uint64" => UInt64, "sint32" => Int32, "sint64" => Int64, "bool" => Bool, "fixed64" => UInt64, "sfixed64" => Int64, "double" => Float64, "string" => String, "bytes" => Slice(UInt8), "fixed32" => UInt32, "sfixed32" => Int32, "float" => Float32}
WIRE_TYPES = {"int32" => 0, "int64" => 0, "uint32" => 0, "uint64" => 0, "sint32" => 0, "sint64" => 0, "bool" => 0, "fixed64" => 1, "sfixed64" => 1, "double" => 1, "string" => 2, "bytes" => 2, "fixed32" => 5, "sfixed32" => 5, "float" => 5}

Constructors

Instance Method Summary

Constructor Detail

def self.new(version : Int32, klass_name : String, lines : Array(Field | Text)) #

[View source]
def self.parse(buf : String) : Schema #

[View source]

Instance Method Detail

def []?(id : Int) : Field | Nil #

[View source]
def []?(name : String) : Field | Nil #

[View source]
def by_id : Hash(Int32, Field) #

[View source]
def by_name : Hash(String, Field) #

[View source]
def fields : Array(Field) #

[View source]
def from_protobuf(io) #

[View source]
def lines : Array(Field | Text) #

[View source]
def texts : Array(Text) #

[View source]
def to_s(io : IO) #
Description copied from class Reference

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>

[View source]
def version : Int32 #

[View source]