This is an automated email from the ASF dual-hosted git repository.

xiazcy pushed a commit to branch go-opts-strat-gl-updates
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 64817af286dc6fe7557e452354846e4d56e0450f
Author: Yang Xia <[email protected]>
AuthorDate: Thu Jan 23 15:33:56 2025 -0800

    update graph binary serializer to 4.0.0 spec
---
 gremlin-go/driver/graphBinary_test.go | 20 +++++++++++++++++---
 gremlin-go/go.mod                     |  4 ++++
 gremlin-go/go.sum                     |  9 +++++++++
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/gremlin-go/driver/graphBinary_test.go 
b/gremlin-go/driver/graphBinary_test.go
index cc80c27ccf..53911e193e 100644
--- a/gremlin-go/driver/graphBinary_test.go
+++ b/gremlin-go/driver/graphBinary_test.go
@@ -24,6 +24,7 @@ import (
        "encoding/binary"
        "fmt"
        "github.com/stretchr/testify/assert"
+       "github.com/wk8/go-ordered-map/v2"
        "golang.org/x/text/language"
        "math/big"
        "reflect"
@@ -218,10 +219,23 @@ func TestGraphBinaryV1(t *testing.T) {
                        source := map[interface{}]interface{}{1: "s1", "s2": 2, 
nil: nil}
                        buf, err := mapWriter(source, &buffer, nil)
                        assert.Nil(t, err)
-                       res, err := readMap(&buf, &pos)
+                       res, err := readMap(&buf, &pos, 0x00)
                        assert.Nil(t, err)
                        assert.Equal(t, fmt.Sprintf("%v", source), 
fmt.Sprintf("%v", res))
                })
+               t.Run("read-write ordered map", func(t *testing.T) {
+                       pos := 0
+                       var buffer bytes.Buffer
+                       source := orderedmap.New[interface{}, interface{}]()
+                       source.Set(int32(1), "s1")
+                       source.Set(int32(2), "s2")
+                       source.Set(nil, nil)
+                       buf, err := mapWriter(source, &buffer, nil)
+                       assert.Nil(t, err)
+                       res, err := readMap(&buf, &pos, 0x02)
+                       assert.Nil(t, err)
+                       assert.Equal(t, source, res)
+               })
                t.Run("read incomparable map: a map value as the key", func(t 
*testing.T) {
                        // prepare test data
                        var buf = &bytes.Buffer{}
@@ -245,7 +259,7 @@ func TestGraphBinaryV1(t *testing.T) {
 
                        data := buf.Bytes()
                        i := 0
-                       result, err := readMap(&data, &i)
+                       result, err := readMap(&data, &i, 0x00)
                        if err != nil {
                                t.Fatalf("readMap failed: %v", err)
                        }
@@ -281,7 +295,7 @@ func TestGraphBinaryV1(t *testing.T) {
 
                        data := buf.Bytes()
                        i := 0
-                       result, err := readMap(&data, &i)
+                       result, err := readMap(&data, &i, 0x00)
                        if err != nil {
                                t.Fatalf("readMap failed: %v", err)
                        }
diff --git a/gremlin-go/go.mod b/gremlin-go/go.mod
index 8fdbf98bc1..3d8b5913e1 100644
--- a/gremlin-go/go.mod
+++ b/gremlin-go/go.mod
@@ -25,11 +25,14 @@ require (
        github.com/gorilla/websocket v1.5.3
        github.com/nicksnyder/go-i18n/v2 v2.5.0
        github.com/stretchr/testify v1.9.0
+       github.com/wk8/go-ordered-map/v2 v2.1.8
        golang.org/x/text v0.21.0
        gopkg.in/yaml.v3 v3.0.1
 )
 
 require (
+       github.com/bahlo/generic-list-go v0.2.0 // indirect
+       github.com/buger/jsonparser v1.1.1 // indirect
        github.com/cucumber/gherkin/go/v26 v26.2.0 // indirect
        github.com/cucumber/messages/go/v21 v21.0.1 // indirect
        github.com/davecgh/go-spew v1.1.1 // indirect
@@ -37,6 +40,7 @@ require (
        github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
        github.com/hashicorp/go-memdb v1.3.4 // indirect
        github.com/hashicorp/golang-lru v0.5.4 // indirect
+       github.com/mailru/easyjson v0.7.7 // indirect
        github.com/pmezard/go-difflib v1.0.0 // indirect
        github.com/spf13/pflag v1.0.5 // indirect
        github.com/stretchr/objx v0.5.2 // indirect
diff --git a/gremlin-go/go.sum b/gremlin-go/go.sum
index 6586cbb584..05327a2afc 100644
--- a/gremlin-go/go.sum
+++ b/gremlin-go/go.sum
@@ -1,5 +1,9 @@
 github.com/BurntSushi/toml v1.4.0 
h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
 github.com/BurntSushi/toml v1.4.0/go.mod 
h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
+github.com/bahlo/generic-list-go v0.2.0 
h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
+github.com/bahlo/generic-list-go v0.2.0/go.mod 
h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
+github.com/buger/jsonparser v1.1.1 
h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
+github.com/buger/jsonparser v1.1.1/go.mod 
h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
 github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod 
h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
 github.com/cucumber/gherkin/go/v26 v26.2.0 
h1:EgIjePLWiPeslwIWmNQ3XHcypPsWAHoMCz/YEBKP4GI=
 github.com/cucumber/gherkin/go/v26 v26.2.0/go.mod 
h1:t2GAPnB8maCT4lkHL99BDCVNzCh1d7dBhCLt150Nr/0=
@@ -30,11 +34,14 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod 
h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
 github.com/hashicorp/golang-lru v0.5.4 
h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
 github.com/hashicorp/golang-lru v0.5.4/go.mod 
h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
 github.com/inconshreveable/mousetrap v1.1.0/go.mod 
h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
+github.com/josharian/intern v1.0.0/go.mod 
h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
 github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
 github.com/kr/pretty v0.2.1/go.mod 
h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
 github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
 github.com/kr/text v0.1.0/go.mod 
h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/mailru/easyjson v0.7.7 
h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
+github.com/mailru/easyjson v0.7.7/go.mod 
h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
 github.com/nicksnyder/go-i18n/v2 v2.5.0 
h1:3wH1gpaekcgGuwzWdSu7JwJhH9Tk87k1ezt0i1p2/Is=
 github.com/nicksnyder/go-i18n/v2 v2.5.0/go.mod 
h1:DrhgsSDZxoAfvVrBVLXoxZn/pN5TXqaDbq7ju94viiQ=
 github.com/pmezard/go-difflib v1.0.0 
h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -54,6 +61,8 @@ github.com/stretchr/testify v1.8.1/go.mod 
h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
 github.com/stretchr/testify v1.8.2/go.mod 
h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
 github.com/stretchr/testify v1.9.0 
h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
 github.com/stretchr/testify v1.9.0/go.mod 
h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
+github.com/wk8/go-ordered-map/v2 v2.1.8 
h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
+github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod 
h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
 golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
 golang.org/x/text v0.21.0/go.mod 
h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod 
h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

Reply via email to