@@ -5,9 +5,24 @@ import (
5
5
"net"
6
6
"time"
7
7
8
+ "github.com/tarantool/go-iproto"
8
9
"github.com/vmihailenco/msgpack/v5"
9
10
)
10
11
12
+ func getSpaceKey (space interface {}) iproto.Key {
13
+ if _ , ok := space .(string ); ok {
14
+ return iproto .IPROTO_SPACE_NAME
15
+ }
16
+ return iproto .IPROTO_SPACE_ID
17
+ }
18
+
19
+ func getIndexKey (index interface {}) iproto.Key {
20
+ if _ , ok := index .(string ); ok {
21
+ return iproto .IPROTO_INDEX_NAME
22
+ }
23
+ return iproto .IPROTO_INDEX_ID
24
+ }
25
+
11
26
func SslDialContext (ctx context.Context , network , address string ,
12
27
opts SslOpts ) (connection net.Conn , err error ) {
13
28
return sslDialContext (ctx , network , address , opts )
@@ -25,39 +40,49 @@ func RefImplPingBody(enc *msgpack.Encoder) error {
25
40
26
41
// RefImplSelectBody is reference implementation for filling of a select
27
42
// request's body.
28
- func RefImplSelectBody (enc * msgpack.Encoder , space , index , offset , limit uint32 , iterator Iter ,
29
- key , after interface {}, fetchPos bool ) error {
30
- return fillSelect (enc , space , index , offset , limit , iterator , key , after , fetchPos )
43
+ func RefImplSelectBody (enc * msgpack.Encoder , space , index interface {},
44
+ offset , limit uint32 , iterator Iter , key , after interface {}, fetchPos bool ) error {
45
+ iprotoSpaceKey := getSpaceKey (space )
46
+ iprotoIndexKey := getIndexKey (index )
47
+ return fillSelect (enc , space , index , offset , limit , iterator , key , after ,
48
+ fetchPos , iprotoSpaceKey , iprotoIndexKey )
31
49
}
32
50
33
51
// RefImplInsertBody is reference implementation for filling of an insert
34
52
// request's body.
35
- func RefImplInsertBody (enc * msgpack.Encoder , space uint32 , tuple interface {}) error {
36
- return fillInsert (enc , space , tuple )
53
+ func RefImplInsertBody (enc * msgpack.Encoder , space , tuple interface {}) error {
54
+ iprotoSpaceKey := getSpaceKey (space )
55
+ return fillInsert (enc , space , tuple , iprotoSpaceKey )
37
56
}
38
57
39
58
// RefImplReplaceBody is reference implementation for filling of a replace
40
59
// request's body.
41
- func RefImplReplaceBody (enc * msgpack.Encoder , space uint32 , tuple interface {}) error {
42
- return fillInsert (enc , space , tuple )
60
+ func RefImplReplaceBody (enc * msgpack.Encoder , space , tuple interface {}) error {
61
+ iprotoSpaceKey := getSpaceKey (space )
62
+ return fillInsert (enc , space , tuple , iprotoSpaceKey )
43
63
}
44
64
45
65
// RefImplDeleteBody is reference implementation for filling of a delete
46
66
// request's body.
47
- func RefImplDeleteBody (enc * msgpack.Encoder , space , index uint32 , key interface {}) error {
48
- return fillDelete (enc , space , index , key )
67
+ func RefImplDeleteBody (enc * msgpack.Encoder , space , index , key interface {}) error {
68
+ iprotoSpaceKey := getSpaceKey (space )
69
+ iprotoIndexKey := getIndexKey (index )
70
+ return fillDelete (enc , space , index , key , iprotoSpaceKey , iprotoIndexKey )
49
71
}
50
72
51
73
// RefImplUpdateBody is reference implementation for filling of an update
52
74
// request's body.
53
- func RefImplUpdateBody (enc * msgpack.Encoder , space , index uint32 , key , ops interface {}) error {
54
- return fillUpdate (enc , space , index , key , ops )
75
+ func RefImplUpdateBody (enc * msgpack.Encoder , space , index , key , ops interface {}) error {
76
+ iprotoSpaceKey := getSpaceKey (space )
77
+ iprotoIndexKey := getIndexKey (index )
78
+ return fillUpdate (enc , space , index , key , ops , iprotoSpaceKey , iprotoIndexKey )
55
79
}
56
80
57
81
// RefImplUpsertBody is reference implementation for filling of an upsert
58
82
// request's body.
59
- func RefImplUpsertBody (enc * msgpack.Encoder , space uint32 , tuple , ops interface {}) error {
60
- return fillUpsert (enc , space , tuple , ops )
83
+ func RefImplUpsertBody (enc * msgpack.Encoder , space , tuple , ops interface {}) error {
84
+ iprotoSpaceKey := getSpaceKey (space )
85
+ return fillUpsert (enc , space , tuple , ops , iprotoSpaceKey )
61
86
}
62
87
63
88
// RefImplCallBody is reference implementation for filling of a call or call17
0 commit comments