v0.0.249 better MDTAny json serialization
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 54s
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 54s
This commit is contained in:
parent
ae43cbb623
commit
21cd1ee066
@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
@ -612,7 +613,15 @@ func (v MetaValue) rawValueForJson() any {
|
|||||||
if v.Value.(AnyWrap).IsNil {
|
if v.Value.(AnyWrap).IsNil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return v.Value.(AnyWrap).Serialize()
|
if v.Value.(AnyWrap).IsError {
|
||||||
|
return bson.M{"@error": true}
|
||||||
|
}
|
||||||
|
jsonobj := gin.H{}
|
||||||
|
if err := json.Unmarshal([]byte(v.Value.(AnyWrap).Json), &jsonobj); err == nil {
|
||||||
|
return jsonobj
|
||||||
|
} else {
|
||||||
|
return bson.M{"type": v.Value.(AnyWrap).Type, "data": v.Value.(AnyWrap).Json}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if v.DataType == MDTID {
|
if v.DataType == MDTID {
|
||||||
if v.Value.(IDWrap).IsNil {
|
if v.Value.(IDWrap).IsNil {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.248"
|
const GoextVersion = "0.0.249"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2023-08-21T15:08:35+0200"
|
const GoextVersionTimestamp = "2023-08-21T15:19:40+0200"
|
||||||
|
Loading…
Reference in New Issue
Block a user