src/pbjson.bend checks
raw source on the hub · import bendonnect-rpc@0.1.0.0/src/pbjson.bend as Pbjson
proto3 JSON runtime for generated code (alias Pj). Pure. Reference: docs/runtime.md.
Writing: accumulate List<&1, Bytes & Json.Val> in REVERSE (each put conses) and finish with Pj.obj.
Reading: Pj.fields(v) gives the object's entries as List<&1, String & Json.Val>; Pj.take
removes one field (by lowerCamel json name or original proto name) and answers its value
(Json.Null{} when absent, which every reader maps to the default).
Readers answer Result<&2, &1, String, T>.
7 imports
import Base import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes import bend-kit-encoding@0.4.0.0/encoding.bend as Enc import bend-kit-json@0.6.1.1/json.bend as Json import bend-kit-protobuf@0.1.0.0/protobuf.bend as Pb import ./b64.bend as B64 import ./pb.bend as Pbr
Types
type JKey source · line 396 · raw
Data
One accepted JSON key (json_name or proto_name) of a field and that field's number.
JKey@name:String -> @num:U32 -> JKey
Definitions
def i32.show source · line 18 · raw
@+x:U32 -> String
def num source · line 21 · raw
@+s:String -> 0x040b6c79c72da50288552227f006b061/json.Val
def str source · line 24 · raw
@+s:String -> 0x040b6c79c72da50288552227f006b061/json.Val
def f32.fin source · line 28 · raw
@kind:U32 -> @+f:F32 -> 0x040b6c79c72da50288552227f006b061/json.Val
Finite F32 -> JSON number; NaN / +-Infinity -> the strings the proto3 JSON spec names.
def f32.kind source · line 39 · raw
@+b:U32 -> U32
def val.double source · line 46 · raw
@+f:F32 -> 0x040b6c79c72da50288552227f006b061/json.Val
def val.float source · line 49 · raw
@+f:F32 -> 0x040b6c79c72da50288552227f006b061/json.Val
def val.int32 source · line 52 · raw
@+x:U32 -> 0x040b6c79c72da50288552227f006b061/json.Val
def val.sint32 source · line 55 · raw
@+x:U32 -> 0x040b6c79c72da50288552227f006b061/json.Val
def val.sfixed32 source · line 58 · raw
@+x:U32 -> 0x040b6c79c72da50288552227f006b061/json.Val
def val.uint32 source · line 61 · raw
@+x:U32 -> 0x040b6c79c72da50288552227f006b061/json.Val
def val.fixed32 source · line 64 · raw
@+x:U32 -> 0x040b6c79c72da50288552227f006b061/json.Val
def val.int64 source · line 68 · raw
@+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> 0x040b6c79c72da50288552227f006b061/json.Val
64-bit integers are quoted decimal strings.
def val.sint64 source · line 71 · raw
@+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> 0x040b6c79c72da50288552227f006b061/json.Val
def val.sfixed64 source · line 74 · raw
@+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> 0x040b6c79c72da50288552227f006b061/json.Val
def val.uint64 source · line 77 · raw
@+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> 0x040b6c79c72da50288552227f006b061/json.Val
def val.fixed64 source · line 80 · raw
@+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> 0x040b6c79c72da50288552227f006b061/json.Val
def val.bool source · line 83 · raw
@+b:Bool -> 0x040b6c79c72da50288552227f006b061/json.Val
def val.string source · line 86 · raw
@+s:String -> 0x040b6c79c72da50288552227f006b061/json.Val
def val.bytes source · line 90 · raw
@+xs:List<&2, U32> -> 0x040b6c79c72da50288552227f006b061/json.Val
Standard base64 with padding.
def val.enum.go source · line 94 · raw
@+s:String -> @+x:U32 -> 0x040b6c79c72da50288552227f006b061/json.Val
name(n) is the enum value's name; "" (unknown number) prints as the number.
def entry source · line 102 · raw
@+key:String -> @v:0x040b6c79c72da50288552227f006b061/json.Val -> Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)
def put.always.v source · line 105 · raw
@+name:String -> @v:0x040b6c79c72da50288552227f006b061/json.Val -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.skip source · line 108 · raw
@skip:Bool -> @+name:String -> @v:0x040b6c79c72da50288552227f006b061/json.Val -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def obj source · line 116 · raw
@acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> 0x040b6c79c72da50288552227f006b061/json.Val
Finishes an accumulator built by put.*: restores field order.
def put.double.always source · line 120 · raw
@+name:String -> @+f:F32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
put.K.always: always emitted (oneof members, proto3 optional).
def put.float.always source · line 123 · raw
@+name:String -> @+f:F32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.int32.always source · line 126 · raw
@+name:String -> @+x:U32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.sint32.always source · line 129 · raw
@+name:String -> @+x:U32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.sfixed32.always source · line 132 · raw
@+name:String -> @+x:U32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.uint32.always source · line 135 · raw
@+name:String -> @+x:U32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.fixed32.always source · line 138 · raw
@+name:String -> @+x:U32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.int64.always source · line 141 · raw
@+name:String -> @+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.sint64.always source · line 144 · raw
@+name:String -> @+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.sfixed64.always source · line 147 · raw
@+name:String -> @+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.uint64.always source · line 150 · raw
@+name:String -> @+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.fixed64.always source · line 153 · raw
@+name:String -> @+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.bool.always source · line 156 · raw
@+name:String -> @+b:Bool -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.string.always source · line 159 · raw
@+name:String -> @+s:String -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.bytes.always source · line 162 · raw
@+name:String -> @+xs:List<&2, U32> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.message source · line 169 · raw
@+name:String -> @v:0x040b6c79c72da50288552227f006b061/json.Val -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
A present message: v is the generated Msg.to_json(m).
def put.double source · line 173 · raw
@+name:String -> @+f:F32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
put.K: omitted when x is the proto3 default.
def put.float source · line 176 · raw
@+name:String -> @+f:F32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.int32 source · line 179 · raw
@+name:String -> @+x:U32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.sint32 source · line 182 · raw
@+name:String -> @+x:U32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.sfixed32 source · line 185 · raw
@+name:String -> @+x:U32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.uint32 source · line 188 · raw
@+name:String -> @+x:U32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.fixed32 source · line 191 · raw
@+name:String -> @+x:U32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.int64 source · line 194 · raw
@+name:String -> @+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.sint64 source · line 197 · raw
@+name:String -> @+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.sfixed64 source · line 200 · raw
@+name:String -> @+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.uint64 source · line 203 · raw
@+name:String -> @+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.fixed64 source · line 206 · raw
@+name:String -> @+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.bool source · line 209 · raw
@+name:String -> @+b:Bool -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.string source · line 212 · raw
@+name:String -> @+s:String -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.bytes source · line 215 · raw
@+name:String -> @+xs:List<&2, U32> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.double source · line 237 · raw
@+name:String -> @xs:List<&2, F32> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.float source · line 240 · raw
@+name:String -> @xs:List<&2, F32> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.int32 source · line 243 · raw
@+name:String -> @xs:List<&2, U32> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.sint32 source · line 246 · raw
@+name:String -> @xs:List<&2, U32> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.sfixed32 source · line 249 · raw
@+name:String -> @xs:List<&2, U32> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.uint32 source · line 252 · raw
@+name:String -> @xs:List<&2, U32> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.fixed32 source · line 255 · raw
@+name:String -> @xs:List<&2, U32> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.int64 source · line 258 · raw
@+name:String -> @xs:List<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.sint64 source · line 261 · raw
@+name:String -> @xs:List<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.sfixed64 source · line 264 · raw
@+name:String -> @xs:List<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.uint64 source · line 267 · raw
@+name:String -> @xs:List<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.fixed64 source · line 270 · raw
@+name:String -> @xs:List<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.bool source · line 273 · raw
@+name:String -> @xs:List<&2, Bool> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.string source · line 276 · raw
@+name:String -> @xs:List<&2, String> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.bytes source · line 279 · raw
@+name:String -> @xs:List<&2, List<&2, U32>> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
def put.repeated.message source · line 286 · raw
@+name:String -> @vs:List<&1, 0x040b6c79c72da50288552227f006b061/json.Val> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
vs: each element's Msg.to_json(m); omitted when empty.
def put.map source · line 294 · raw
@+name:String -> @entries:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
map<K,V>: entries built with Pj.entry(Pj.key.K(k), value); omitted when empty.
def key.int32 source · line 302 · raw
@+x:U32 -> String
map keys as JSON object keys
def key.sint32 source · line 305 · raw
@+x:U32 -> String
def key.sfixed32 source · line 308 · raw
@+x:U32 -> String
def key.uint32 source · line 311 · raw
@+x:U32 -> String
def key.fixed32 source · line 314 · raw
@+x:U32 -> String
def key.int64 source · line 317 · raw
@+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> String
def key.sint64 source · line 320 · raw
@+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> String
def key.sfixed64 source · line 323 · raw
@+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> String
def key.uint64 source · line 326 · raw
@+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> String
def key.fixed64 source · line 329 · raw
@+w:0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64 -> String
def key.bool source · line 332 · raw
@+b:Bool -> String
def key.string source · line 335 · raw
@+s:String -> String
def encode source · line 340 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes
def parse.fin source · line 343 · raw
@m:Maybe<&1, 0x040b6c79c72da50288552227f006b061/json.Val> -> Result<&2, &1, String, 0x040b6c79c72da50288552227f006b061/json.Val>
def parse source · line 350 · raw
@b:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> Result<&2, &1, String, 0x040b6c79c72da50288552227f006b061/json.Val>
def fields.go source · line 355 · raw
@kvs:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(String, 0x040b6c79c72da50288552227f006b061/json.Val)>
def fields source · line 364 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&1, Pair(String, 0x040b6c79c72da50288552227f006b061/json.Val)>>
The entries of a JSON object, keys decoded. A non-object (including null) is an error; for singular message fields test for null first with Pj.read.opt.
def read.map.entries source · line 380 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&1, Pair(String, 0x040b6c79c72da50288552227f006b061/json.Val)>>
A map field's entries (keys as strings); null is an empty map.
def dispatch source · line 401 · raw
@+k:String -> @table:List<&2, JKey> -> U32
The number of the field whose accepted key equals k, or 0 for an unknown key. Typical use:
M.set(m, Pj.dispatch(k, M.json_keys()), v) where M.set destructures m, then matches on its U32 parameter.
def is_key source · line 408 · raw
@+k:String -> @+jn:String -> @+pn:String -> Bool
def take.step source · line 411 · raw
@hit:Bool -> @k:String -> @v:0x040b6c79c72da50288552227f006b061/json.Val -> @r:Pair(0x040b6c79c72da50288552227f006b061/json.Val, List<&1, Pair(String, 0x040b6c79c72da50288552227f006b061/json.Val)>) -> Pair(0x040b6c79c72da50288552227f006b061/json.Val, List<&1, Pair(String, 0x040b6c79c72da50288552227f006b061/json.Val)>)
def take.go source · line 420 · raw
@+jn:String -> @+pn:String -> @kvs:List<&1, Pair(String, 0x040b6c79c72da50288552227f006b061/json.Val)> -> Pair(0x040b6c79c72da50288552227f006b061/json.Val, List<&1, Pair(String, 0x040b6c79c72da50288552227f006b061/json.Val)>)
def take source · line 430 · raw
@kvs:List<&1, Pair(String, 0x040b6c79c72da50288552227f006b061/json.Val)> -> @+json_name:String -> @+proto_name:String -> Pair(0x040b6c79c72da50288552227f006b061/json.Val, List<&1, Pair(String, 0x040b6c79c72da50288552227f006b061/json.Val)>)
Removes the field named json_name or proto_name and answers its value (Json.Null{} if absent, which every Pj.read.* maps to the default) beside the remaining entries. Unknown keys simply stay in the rest and can be dropped. A later duplicate of a matched key is removed too.
def lift.m source · line 435 · raw
@-T:Data -> @m:Maybe<&2, T> -> @what:String -> Result<&2, &1, String, T>
def int32.fin source · line 442 · raw
@m:Maybe<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64> -> Maybe<&2, U32>
def uint32.fin source · line 450 · raw
@m:Maybe<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64> -> Maybe<&2, U32>
def parse.int32 source · line 459 · raw
@+s:String -> Maybe<&2, U32>
Decimal text (optionally negative) that fits int32 / uint32 / int64 / uint64.
def parse.uint32 source · line 462 · raw
@+s:String -> Maybe<&2, U32>
def parse.int64 source · line 465 · raw
@+s:String -> Maybe<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>
def parse.uint64 source · line 468 · raw
@+s:String -> Maybe<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>
def parse.float source · line 471 · raw
@+s:String -> Maybe<&2, F32>
def read.int32 source · line 493 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, U32>
def read.sint32 source · line 496 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, U32>
def read.sfixed32 source · line 499 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, U32>
def read.uint32 source · line 502 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, U32>
def read.fixed32 source · line 505 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, U32>
def read.int64 source · line 508 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>
def read.sint64 source · line 511 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>
def read.sfixed64 source · line 514 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>
def read.uint64 source · line 517 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>
def read.fixed64 source · line 520 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>
def read.float source · line 523 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, F32>
def read.double source · line 526 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, F32>
def read.bool source · line 529 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, Bool>
def read.string source · line 544 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, String>
def bytes.fin source · line 559 · raw
@m:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> Result<&2, &1, String, List<&2, U32>>
def read.bytes source · line 567 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, U32>>
Standard or URL-safe base64, padded or not.
def read.repeated.double source · line 648 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, F32>>
def read.repeated.float source · line 651 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, F32>>
def read.repeated.int32 source · line 654 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, U32>>
def read.repeated.sint32 source · line 657 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, U32>>
def read.repeated.sfixed32 source · line 660 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, U32>>
def read.repeated.uint32 source · line 663 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, U32>>
def read.repeated.fixed32 source · line 666 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, U32>>
def read.repeated.int64 source · line 669 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>>
def read.repeated.sint64 source · line 672 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>>
def read.repeated.sfixed64 source · line 675 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>>
def read.repeated.uint64 source · line 678 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>>
def read.repeated.fixed64 source · line 681 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>>
def read.repeated.bool source · line 684 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, Bool>>
def read.repeated.string source · line 687 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, String>>
def read.repeated.bytes source · line 690 · raw
@v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, List<&2, U32>>>
def read.key.int32 source · line 697 · raw
@+s:String -> Result<&2, &1, String, U32>
map keys (JSON object keys are strings)
def read.key.sint32 source · line 700 · raw
@+s:String -> Result<&2, &1, String, U32>
def read.key.sfixed32 source · line 703 · raw
@+s:String -> Result<&2, &1, String, U32>
def read.key.uint32 source · line 706 · raw
@+s:String -> Result<&2, &1, String, U32>
def read.key.fixed32 source · line 709 · raw
@+s:String -> Result<&2, &1, String, U32>
def read.key.int64 source · line 712 · raw
@+s:String -> Result<&2, &1, String, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>
def read.key.sint64 source · line 715 · raw
@+s:String -> Result<&2, &1, String, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>
def read.key.sfixed64 source · line 718 · raw
@+s:String -> Result<&2, &1, String, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>
def read.key.uint64 source · line 721 · raw
@+s:String -> Result<&2, &1, String, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>
def read.key.fixed64 source · line 724 · raw
@+s:String -> Result<&2, &1, String, 0x8843bff7971fd45a4db82e4200ac8bd6/protobuf.Word64>
def read.key.bool source · line 727 · raw
@+s:String -> Result<&2, &1, String, Bool>
def read.key.string source · line 731 · raw
@+s:String -> Result<&2, &1, String, String>
Templates
template val.enum source · line 97 · raw
@-name:(@+n:U32 -> String) -> @+x:U32 -> 0x040b6c79c72da50288552227f006b061/json.Val
template put.enum.always source · line 165 · raw
@-name:(@+n:U32 -> String) -> @+jn:String -> @+x:U32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
template put.enum source · line 218 · raw
@-name:(@+n:U32 -> String) -> @+jn:String -> @+x:U32 -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
template rep.arr source · line 223 · raw
@-T:Data -> @-val:(@+x:T -> 0x040b6c79c72da50288552227f006b061/json.Val) -> @xs:List<&2, T> -> List<&1, 0x040b6c79c72da50288552227f006b061/json.Val>
template rep.put source · line 230 · raw
@-T:Data -> @-val:(@+x:T -> 0x040b6c79c72da50288552227f006b061/json.Val) -> @+name:String -> @xs:List<&2, T> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
template put.repeated.enum source · line 282 · raw
@-name:(@+n:U32 -> String) -> @+jn:String -> @xs:List<&2, U32> -> @acc:List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)> -> List<&1, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x040b6c79c72da50288552227f006b061/json.Val)>
template read.scalar source · line 478 · raw
@-T:Data -> @-parse:(@+s:String -> Maybe<&2, T>) -> @+dflt:T -> @+what:String -> @v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, T>
null -> dflt; number or string -> parse(text); anything else is an error.
template read.enum source · line 583 · raw
@-from_name:(@+s:String -> Maybe<&2, U32>) -> @v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, U32>
Enum by name (from_name = the generated E.from_name) or by number; null -> 0.
template opt.some source · line 598 · raw
@-T:Data -> @-read:(@_:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, T>) -> @v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, Maybe<&2, T>>
template read.opt source · line 605 · raw
@-T:Data -> @-read:(@_:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, T>) -> @v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, Maybe<&2, T>>
Presence-aware read for optional scalars, oneof members and singular messages: null/absent -> None, otherwise Some(read(v)).
template rep.read source · line 622 · raw
@-T:Data -> @-read:(@_:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, T>) -> @xs:List<&1, 0x040b6c79c72da50288552227f006b061/json.Val> -> Result<&2, &1, String, List<&2, T>>
template read.repeated source · line 633 · raw
@-T:Data -> @-read:(@_:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, T>) -> @v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, T>>
null -> []; array -> each element through read (for messages pass ~Msg.from_json).
template read.repeated.enum source · line 693 · raw
@-from_name:(@+s:String -> Maybe<&2, U32>) -> @v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, U32>>
template map.go source · line 734 · raw
@-K:Data -> @-V:Data -> @-E:Data -> @-key:(@+s:String -> Result<&2, &1, String, K>) -> @-value:(@_:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, V>) -> @-mk:(@+k:K -> @+v:V -> E) -> @es:List<&1, Pair(String, 0x040b6c79c72da50288552227f006b061/json.Val)> -> Result<&2, &1, String, List<&2, E>>
template read.map source · line 747 · raw
@-K:Data -> @-V:Data -> @-E:Data -> @-key:(@+s:String -> Result<&2, &1, String, K>) -> @-value:(@_:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, V>) -> @-mk:(@+k:K -> @+v:V -> E) -> @v:0x040b6c79c72da50288552227f006b061/json.Val -> Result<&2, &1, String, List<&2, E>>
Whole map field in one call: keys via ~Pj.read.key.K, values via ~Pj.read.V (or ~Msg.from_json), entries built by mk (e.g. ~(+k => +v => Entry{k, v})). null -> [].