mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Switch to ugorji/go/codec
Should be equivalent to ugocodec if enabling TimeNotBuiltin.
This commit is contained in:
committed by
Dan Christian Bogos
parent
920a5ab343
commit
1a1ba55b25
@@ -209,7 +209,7 @@ func (asr *StatASR) Marshal(ms Marshaler) (marshaled []byte, err error) {
|
||||
|
||||
// LoadMarshaled is part of StatMetric interface
|
||||
func (asr *StatASR) LoadMarshaled(ms Marshaler, marshaled []byte) (err error) {
|
||||
return ms.Unmarshal(marshaled, asr)
|
||||
return ms.Unmarshal(marshaled, &asr)
|
||||
}
|
||||
|
||||
// GetFilterIDs is part of StatMetric interface
|
||||
@@ -363,7 +363,7 @@ func (acd *StatACD) Marshal(ms Marshaler) (marshaled []byte, err error) {
|
||||
return ms.Marshal(acd)
|
||||
}
|
||||
func (acd *StatACD) LoadMarshaled(ms Marshaler, marshaled []byte) (err error) {
|
||||
return ms.Unmarshal(marshaled, acd)
|
||||
return ms.Unmarshal(marshaled, &acd)
|
||||
}
|
||||
|
||||
// GetFilterIDs is part of StatMetric interface
|
||||
@@ -519,7 +519,7 @@ func (tcd *StatTCD) Marshal(ms Marshaler) (marshaled []byte, err error) {
|
||||
}
|
||||
|
||||
func (tcd *StatTCD) LoadMarshaled(ms Marshaler, marshaled []byte) (err error) {
|
||||
return ms.Unmarshal(marshaled, tcd)
|
||||
return ms.Unmarshal(marshaled, &tcd)
|
||||
}
|
||||
|
||||
// GetFilterIDs is part of StatMetric interface
|
||||
@@ -670,7 +670,7 @@ func (acc *StatACC) Marshal(ms Marshaler) (marshaled []byte, err error) {
|
||||
}
|
||||
|
||||
func (acc *StatACC) LoadMarshaled(ms Marshaler, marshaled []byte) (err error) {
|
||||
return ms.Unmarshal(marshaled, acc)
|
||||
return ms.Unmarshal(marshaled, &acc)
|
||||
}
|
||||
|
||||
// GetFilterIDs is part of StatMetric interface
|
||||
@@ -823,7 +823,7 @@ func (tcc *StatTCC) Marshal(ms Marshaler) (marshaled []byte, err error) {
|
||||
}
|
||||
|
||||
func (tcc *StatTCC) LoadMarshaled(ms Marshaler, marshaled []byte) (err error) {
|
||||
return ms.Unmarshal(marshaled, tcc)
|
||||
return ms.Unmarshal(marshaled, &tcc)
|
||||
}
|
||||
|
||||
// GetFilterIDs is part of StatMetric interface
|
||||
@@ -976,7 +976,7 @@ func (pdd *StatPDD) Marshal(ms Marshaler) (marshaled []byte, err error) {
|
||||
return ms.Marshal(pdd)
|
||||
}
|
||||
func (pdd *StatPDD) LoadMarshaled(ms Marshaler, marshaled []byte) (err error) {
|
||||
return ms.Unmarshal(marshaled, pdd)
|
||||
return ms.Unmarshal(marshaled, &pdd)
|
||||
}
|
||||
|
||||
// GetFilterIDs is part of StatMetric interface
|
||||
@@ -1141,7 +1141,7 @@ func (ddc *StatDDC) Marshal(ms Marshaler) (marshaled []byte, err error) {
|
||||
}
|
||||
|
||||
func (ddc *StatDDC) LoadMarshaled(ms Marshaler, marshaled []byte) (err error) {
|
||||
return ms.Unmarshal(marshaled, ddc)
|
||||
return ms.Unmarshal(marshaled, &ddc)
|
||||
}
|
||||
|
||||
// GetFilterIDs is part of StatMetric interface
|
||||
@@ -1290,7 +1290,7 @@ func (sum *StatSum) Marshal(ms Marshaler) (marshaled []byte, err error) {
|
||||
}
|
||||
|
||||
func (sum *StatSum) LoadMarshaled(ms Marshaler, marshaled []byte) (err error) {
|
||||
return ms.Unmarshal(marshaled, sum)
|
||||
return ms.Unmarshal(marshaled, &sum)
|
||||
}
|
||||
|
||||
// GetFilterIDs is part of StatMetric interface
|
||||
@@ -1444,7 +1444,7 @@ func (avg *StatAverage) Marshal(ms Marshaler) (marshaled []byte, err error) {
|
||||
}
|
||||
|
||||
func (avg *StatAverage) LoadMarshaled(ms Marshaler, marshaled []byte) (err error) {
|
||||
return ms.Unmarshal(marshaled, avg)
|
||||
return ms.Unmarshal(marshaled, &avg)
|
||||
}
|
||||
|
||||
// GetFilterIDs is part of StatMetric interface
|
||||
@@ -1612,7 +1612,7 @@ func (dst *StatDistinct) Marshal(ms Marshaler) (marshaled []byte, err error) {
|
||||
}
|
||||
|
||||
func (dst *StatDistinct) LoadMarshaled(ms Marshaler, marshaled []byte) (err error) {
|
||||
return ms.Unmarshal(marshaled, dst)
|
||||
return ms.Unmarshal(marshaled, &dst)
|
||||
}
|
||||
|
||||
// GetFilterIDs is part of StatMetric interface
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
"reflect"
|
||||
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/cgrates/ugocodec/codec"
|
||||
"github.com/ugorji/go/codec"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
|
||||
@@ -259,11 +259,11 @@ type CodecMsgpackMarshaler struct {
|
||||
}
|
||||
|
||||
func NewCodecMsgpackMarshaler() *CodecMsgpackMarshaler {
|
||||
cmm := &CodecMsgpackMarshaler{new(codec.MsgpackHandle)}
|
||||
mh := cmm.mh
|
||||
mh := new(codec.MsgpackHandle)
|
||||
mh.MapType = reflect.TypeOf(map[string]any(nil))
|
||||
mh.RawToString = true
|
||||
return cmm
|
||||
mh.TimeNotBuiltin = true
|
||||
return &CodecMsgpackMarshaler{mh}
|
||||
}
|
||||
|
||||
func (cmm *CodecMsgpackMarshaler) Marshal(v any) (b []byte, err error) {
|
||||
@@ -274,7 +274,7 @@ func (cmm *CodecMsgpackMarshaler) Marshal(v any) (b []byte, err error) {
|
||||
|
||||
func (cmm *CodecMsgpackMarshaler) Unmarshal(data []byte, v any) error {
|
||||
dec := codec.NewDecoderBytes(data, cmm.mh)
|
||||
return dec.Decode(&v)
|
||||
return dec.Decode(v)
|
||||
}
|
||||
|
||||
type BincMarshaler struct {
|
||||
@@ -293,7 +293,7 @@ func (bm *BincMarshaler) Marshal(v any) (b []byte, err error) {
|
||||
|
||||
func (bm *BincMarshaler) Unmarshal(data []byte, v any) error {
|
||||
dec := codec.NewDecoderBytes(data, bm.bh)
|
||||
return dec.Decode(&v)
|
||||
return dec.Decode(v)
|
||||
}
|
||||
|
||||
type GOBMarshaler struct{}
|
||||
|
||||
@@ -77,6 +77,7 @@ func TestMsgpackTime(t *testing.T) {
|
||||
t.Errorf("error unmarshalling structure: %#v %#v %v", t1, t2, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStorageDestinationContainsPrefixShort(t *testing.T) {
|
||||
dest, err := dm.GetDestination("NAT", false, true, utils.NonTransactional)
|
||||
precision := dest.containsPrefix("0723")
|
||||
|
||||
2
go.mod
2
go.mod
@@ -26,7 +26,6 @@ require (
|
||||
github.com/cgrates/radigo v0.0.0-20240123163129-491c899df727
|
||||
github.com/cgrates/rpcclient v0.0.0-20230605090759-8bb5188b73e5
|
||||
github.com/cgrates/sipingo v1.0.1-0.20200514112313-699ebc1cdb8e
|
||||
github.com/cgrates/ugocodec v0.0.0-20201023092048-df93d0123f60
|
||||
github.com/creack/pty v1.1.20
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/elastic/elastic-transport-go/v8 v8.3.0
|
||||
@@ -44,6 +43,7 @@ require (
|
||||
github.com/peterh/liner v1.2.2
|
||||
github.com/rabbitmq/amqp091-go v1.9.0
|
||||
github.com/segmentio/kafka-go v0.4.44
|
||||
github.com/ugorji/go/codec v1.2.12
|
||||
go.mongodb.org/mongo-driver v1.12.1
|
||||
golang.org/x/crypto v0.19.0
|
||||
golang.org/x/net v0.21.0
|
||||
|
||||
14
go.sum
14
go.sum
@@ -78,8 +78,6 @@ github.com/cgrates/rpcclient v0.0.0-20230605090759-8bb5188b73e5 h1:GhA5qBUK7o0j+
|
||||
github.com/cgrates/rpcclient v0.0.0-20230605090759-8bb5188b73e5/go.mod h1:tDqS6BieViKYpz696//gxseUN1b92hPHqk+w0CzY8AE=
|
||||
github.com/cgrates/sipingo v1.0.1-0.20200514112313-699ebc1cdb8e h1:izFjZB83/XRXInc+gMIssUxdbleGsGIuGCPj2u7RQo0=
|
||||
github.com/cgrates/sipingo v1.0.1-0.20200514112313-699ebc1cdb8e/go.mod h1:0f2+3dq5Iiv3VlcuY83VPJ0QzqRlzDG1Cr8okogQE3g=
|
||||
github.com/cgrates/ugocodec v0.0.0-20201023092048-df93d0123f60 h1:TQDg+HGB17LU8FitLiLvYazYSy62GQ1lO3lGKI3xUrU=
|
||||
github.com/cgrates/ugocodec v0.0.0-20201023092048-df93d0123f60/go.mod h1:IgtdpNMJWBizo4jr4zzvpJq8NEu/FGkwCn6akZZzAGk=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/couchbase/ghistogram v0.1.0 h1:b95QcQTCzjTUocDXp/uMgSNQi8oj1tGwnJ4bODWZnps=
|
||||
@@ -183,8 +181,6 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
|
||||
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
|
||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
|
||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/json-iterator/go v0.0.0-20171115153421-f7279a603ede h1:YrgBGwxMRK0Vq0WSCWFaZUnTsrA/PZE/xs1QZh+/edg=
|
||||
github.com/json-iterator/go v0.0.0-20171115153421-f7279a603ede/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||
@@ -194,8 +190,6 @@ github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQs
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
|
||||
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4=
|
||||
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mediocregopher/radix/v3 v3.8.1 h1:rOkHflVuulFKlwsLY01/M2cM2tWCjDoETcMqKbAWu1M=
|
||||
@@ -223,14 +217,10 @@ github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/peterh/liner v1.2.2 h1:aJ4AOodmL+JxOZZEL2u9iJf8omNRpqHc/EbrK+3mAXw=
|
||||
github.com/peterh/liner v1.2.2/go.mod h1:xFwJyiKIXJZUKItq5dGHZSTBRAuG/CpeNpWLyiNRNwI=
|
||||
github.com/philhofer/fwd v1.1.0 h1:PAdZw9+/BCf4gc/kA2L/PbGPkFe72Kl2GLZXTG8HpU8=
|
||||
github.com/philhofer/fwd v1.1.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
|
||||
github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0=
|
||||
github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pquerna/ffjson v0.0.0-20190930134022-aa0246cd15f7 h1:xoIK0ctDddBMnc74udxJYBqlo9Ylnsp1waqjLsnef20=
|
||||
github.com/pquerna/ffjson v0.0.0-20190930134022-aa0246cd15f7/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/rabbitmq/amqp091-go v1.9.0 h1:qrQtyzB4H8BQgEuJwhmVQqVHB9O4+MNDJCCAcpc3Aoo=
|
||||
github.com/rabbitmq/amqp091-go v1.9.0/go.mod h1:+jPrT9iY2eLjRaMSRHUhc3z14E/l85kv/f+6luSD3pc=
|
||||
@@ -247,8 +237,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/tinylib/msgp v1.1.2 h1:gWmO7n0Ys2RBEb7GPYB9Ujq8Mk5p2U08lRnmMcGy6BQ=
|
||||
github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
|
||||
|
||||
Reference in New Issue
Block a user