File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -212,16 +212,18 @@ func (r RequestId) Value() any {
212
212
func (r RequestId ) String () string {
213
213
switch v := r .value .(type ) {
214
214
case string :
215
- return v
215
+ return "string:" + v
216
216
case int64 :
217
- return strconv .FormatInt (v , 10 )
217
+ return "int64:" + strconv .FormatInt (v , 10 )
218
218
case float64 :
219
219
if v == float64 (int64 (v )) {
220
- return strconv .FormatInt (int64 (v ), 10 )
220
+ return "int64:" + strconv .FormatInt (int64 (v ), 10 )
221
221
}
222
- return strconv .FormatFloat (v , 'f' , - 1 , 64 )
222
+ return "float64:" + strconv .FormatFloat (v , 'f' , - 1 , 64 )
223
+ case nil :
224
+ return "<nil>"
223
225
default :
224
- return fmt .Sprintf ("%v" , v )
226
+ return "unknown:" + fmt .Sprintf ("%v" , v )
225
227
}
226
228
}
227
229
@@ -235,6 +237,12 @@ func (r RequestId) MarshalJSON() ([]byte, error) {
235
237
}
236
238
237
239
func (r * RequestId ) UnmarshalJSON (data []byte ) error {
240
+
241
+ if string (data ) == "null" {
242
+ r .value = nil
243
+ return nil
244
+ }
245
+
238
246
// Try unmarshaling as string first
239
247
var s string
240
248
if err := json .Unmarshal (data , & s ); err == nil {
You can’t perform that action at this time.
0 commit comments