-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgen_result_json.go
43 lines (38 loc) · 1.04 KB
/
gen_result_json.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package inference
import (
"encoding/json"
"errors"
"github.com/CortexFoundation/CortexTheseus/common/hexutil"
)
// MarshalJSON marshals as JSON.
func (i InferResult) MarshalJSON() ([]byte, error) {
type InferResult struct {
Data hexutil.Bytes `json:"data" gencodec:"required"`
Info string `json:"info" gencodec:"required"`
}
var enc InferResult
enc.Data = i.Data
enc.Info = i.Info
return json.Marshal(&enc)
}
// UnmarshalJSON unmarshals from JSON.
func (i *InferResult) UnmarshalJSON(input []byte) error {
type InferResult struct {
Data *hexutil.Bytes `json:"data" gencodec:"required"`
Info *string `json:"info" gencodec:"required"`
}
var dec InferResult
if err := json.Unmarshal(input, &dec); err != nil {
return err
}
if dec.Data == nil {
return errors.New("missing required field 'data' for InferResult")
}
i.Data = *dec.Data
if dec.Info == nil {
return errors.New("missing required field 'info' for InferResult")
}
i.Info = *dec.Info
return nil
}