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
@@ -25,39 +26,50 @@ func RefImplPingBody(enc *msgpack.Encoder) error {
25
26
26
27
// RefImplSelectBody is reference implementation for filling of a select
27
28
// 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 )
29
+ func RefImplSelectBody (enc * msgpack.Encoder , space , index interface {},
30
+ offset , limit uint32 , iterator Iter , key , after interface {}, fetchPos bool ) error {
31
+ iprotoSpaceKey := iproto .IPROTO_SPACE_ID
32
+ iprotoIndexKey := iproto .IPROTO_INDEX_ID
33
+ if _ , ok := space .(string ); ok {
34
+ iprotoSpaceKey = iproto .IPROTO_SPACE_NAME
35
+ }
36
+ if _ , ok := index .(string ); ok {
37
+ iprotoIndexKey = iproto .IPROTO_INDEX_NAME
38
+ }
39
+ return fillSelect (enc , space , index , offset , limit , iterator , key , after ,
40
+ fetchPos , iprotoSpaceKey , iprotoIndexKey )
31
41
}
32
42
33
43
// RefImplInsertBody is reference implementation for filling of an insert
34
44
// request's body.
35
45
func RefImplInsertBody (enc * msgpack.Encoder , space uint32 , tuple interface {}) error {
36
- return fillInsert (enc , space , tuple )
46
+ return fillInsert (enc , space , tuple , iproto . IPROTO_SPACE_ID )
37
47
}
38
48
39
49
// RefImplReplaceBody is reference implementation for filling of a replace
40
50
// request's body.
41
51
func RefImplReplaceBody (enc * msgpack.Encoder , space uint32 , tuple interface {}) error {
42
- return fillInsert (enc , space , tuple )
52
+ return fillInsert (enc , space , tuple , iproto . IPROTO_SPACE_ID )
43
53
}
44
54
45
55
// RefImplDeleteBody is reference implementation for filling of a delete
46
56
// request's body.
47
57
func RefImplDeleteBody (enc * msgpack.Encoder , space , index uint32 , key interface {}) error {
48
- return fillDelete (enc , space , index , key )
58
+ return fillDelete (enc , space , index , key ,
59
+ iproto .IPROTO_SPACE_ID , iproto .IPROTO_INDEX_ID )
49
60
}
50
61
51
62
// RefImplUpdateBody is reference implementation for filling of an update
52
63
// request's body.
53
64
func RefImplUpdateBody (enc * msgpack.Encoder , space , index uint32 , key , ops interface {}) error {
54
- return fillUpdate (enc , space , index , key , ops )
65
+ return fillUpdate (enc , space , index , key , ops ,
66
+ iproto .IPROTO_SPACE_ID , iproto .IPROTO_INDEX_ID )
55
67
}
56
68
57
69
// RefImplUpsertBody is reference implementation for filling of an upsert
58
70
// request's body.
59
71
func RefImplUpsertBody (enc * msgpack.Encoder , space uint32 , tuple , ops interface {}) error {
60
- return fillUpsert (enc , space , tuple , ops )
72
+ return fillUpsert (enc , space , tuple , ops , iproto . IPROTO_SPACE_ID )
61
73
}
62
74
63
75
// RefImplCallBody is reference implementation for filling of a call or call17
0 commit comments