adding bool suport to protobuf methods

This commit is contained in:
Dmitriy Ryajov 2019-09-11 13:06:50 -06:00
parent 003b72ec27
commit 875ec346e6
1 changed files with 5 additions and 0 deletions

View File

@ -90,6 +90,11 @@ proc initProtoField*(index: int, value: SomeVarint): ProtoField =
else: else:
result.vint = cast[uint64](value) result.vint = cast[uint64](value)
proc initProtoField*(index: int, value: bool): ProtoField =
## Initialize ProtoField with integer value.
result = ProtoField(kind: Varint, index: index)
result.vint = byte(value)
proc initProtoField*(index: int, value: openarray[byte]): ProtoField = proc initProtoField*(index: int, value: openarray[byte]): ProtoField =
## Initialize ProtoField with bytes array. ## Initialize ProtoField with bytes array.
result = ProtoField(kind: Length, index: index) result = ProtoField(kind: Length, index: index)