[#120] protogen: Unmarshal stringified integers from JSON
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
eeb754c327
commit
d94b9c6d0d
13 changed files with 536 additions and 61 deletions
90
netmap/grpc/types_frostfs.pb.go
generated
90
netmap/grpc/types_frostfs.pb.go
generated
|
@ -703,7 +703,15 @@ func (x *Selector) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "count":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.Count = f
|
||||
}
|
||||
case "clause":
|
||||
|
@ -970,7 +978,15 @@ func (x *Replica) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "count":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.Count = f
|
||||
}
|
||||
case "selector":
|
||||
|
@ -982,13 +998,29 @@ func (x *Replica) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "ecDataCount":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.EcDataCount = f
|
||||
}
|
||||
case "ecParityCount":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.EcParityCount = f
|
||||
}
|
||||
}
|
||||
|
@ -1306,7 +1338,15 @@ func (x *PlacementPolicy) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "containerBackupFactor":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.ContainerBackupFactor = f
|
||||
}
|
||||
case "selectors":
|
||||
|
@ -2094,7 +2134,15 @@ func (x *Netmap) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "epoch":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.Epoch = f
|
||||
}
|
||||
case "nodes":
|
||||
|
@ -2677,19 +2725,43 @@ func (x *NetworkInfo) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "currentEpoch":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.CurrentEpoch = f
|
||||
}
|
||||
case "magicNumber":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.MagicNumber = f
|
||||
}
|
||||
case "msPerBlock":
|
||||
{
|
||||
var f int64
|
||||
f = in.Int64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseInt(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := int64(v)
|
||||
f = pv
|
||||
x.MsPerBlock = f
|
||||
}
|
||||
case "networkConfig":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue