forked from fl00r/go-tarantool-1.6
-
Notifications
You must be signed in to change notification settings - Fork 58
/
export_test.go
158 lines (138 loc) · 4.8 KB
/
export_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
package tarantool
import (
"time"
"github.com/vmihailenco/msgpack/v5"
)
// RefImplPingBody is reference implementation for filling of a ping
// request's body.
func RefImplPingBody(enc *msgpack.Encoder) error {
return fillPing(enc)
}
// RefImplSelectBody is reference implementation for filling of a select
// request's body.
func RefImplSelectBody(enc *msgpack.Encoder, res SchemaResolver, space, index interface{},
offset, limit uint32, iterator Iter, key, after interface{}, fetchPos bool) error {
spaceEnc, err := newSpaceEncoder(res, space)
if err != nil {
return err
}
indexEnc, err := newIndexEncoder(res, index, spaceEnc.Id)
if err != nil {
return err
}
return fillSelect(enc, spaceEnc, indexEnc, offset, limit, iterator, key, after, fetchPos)
}
// RefImplInsertBody is reference implementation for filling of an insert
// request's body.
func RefImplInsertBody(enc *msgpack.Encoder, res SchemaResolver, space,
tuple interface{}) error {
spaceEnc, err := newSpaceEncoder(res, space)
if err != nil {
return err
}
return fillInsert(enc, spaceEnc, tuple)
}
// RefImplReplaceBody is reference implementation for filling of a replace
// request's body.
func RefImplReplaceBody(enc *msgpack.Encoder, res SchemaResolver, space,
tuple interface{}) error {
spaceEnc, err := newSpaceEncoder(res, space)
if err != nil {
return err
}
return fillInsert(enc, spaceEnc, tuple)
}
// RefImplDeleteBody is reference implementation for filling of a delete
// request's body.
func RefImplDeleteBody(enc *msgpack.Encoder, res SchemaResolver, space, index,
key interface{}) error {
spaceEnc, err := newSpaceEncoder(res, space)
if err != nil {
return err
}
indexEnc, err := newIndexEncoder(res, index, spaceEnc.Id)
if err != nil {
return err
}
return fillDelete(enc, spaceEnc, indexEnc, key)
}
// RefImplUpdateBody is reference implementation for filling of an update
// request's body.
func RefImplUpdateBody(enc *msgpack.Encoder, res SchemaResolver, space, index,
key interface{}, ops *Operations) error {
spaceEnc, err := newSpaceEncoder(res, space)
if err != nil {
return err
}
indexEnc, err := newIndexEncoder(res, index, spaceEnc.Id)
if err != nil {
return err
}
return fillUpdate(enc, spaceEnc, indexEnc, key, ops)
}
// RefImplUpsertBody is reference implementation for filling of an upsert
// request's body.
func RefImplUpsertBody(enc *msgpack.Encoder, res SchemaResolver, space,
tuple interface{}, ops *Operations) error {
spaceEnc, err := newSpaceEncoder(res, space)
if err != nil {
return err
}
return fillUpsert(enc, spaceEnc, tuple, ops)
}
// RefImplCallBody is reference implementation for filling of a call or call17
// request's body.
func RefImplCallBody(enc *msgpack.Encoder, function string, args interface{}) error {
return fillCall(enc, function, args)
}
// RefImplEvalBody is reference implementation for filling of an eval
// request's body.
func RefImplEvalBody(enc *msgpack.Encoder, expr string, args interface{}) error {
return fillEval(enc, expr, args)
}
// RefImplExecuteBody is reference implementation for filling of an execute
// request's body.
func RefImplExecuteBody(enc *msgpack.Encoder, expr string, args interface{}) error {
return fillExecute(enc, expr, args)
}
// RefImplPrepareBody is reference implementation for filling of an prepare
// request's body.
func RefImplPrepareBody(enc *msgpack.Encoder, expr string) error {
return fillPrepare(enc, expr)
}
// RefImplUnprepareBody is reference implementation for filling of an execute prepared
// request's body.
func RefImplExecutePreparedBody(enc *msgpack.Encoder, stmt Prepared, args interface{}) error {
return fillExecutePrepared(enc, stmt, args)
}
// RefImplUnprepareBody is reference implementation for filling of an unprepare
// request's body.
func RefImplUnprepareBody(enc *msgpack.Encoder, stmt Prepared) error {
return fillUnprepare(enc, stmt)
}
// RefImplBeginBody is reference implementation for filling of an begin
// request's body.
func RefImplBeginBody(enc *msgpack.Encoder, txnIsolation TxnIsolationLevel,
timeout time.Duration) error {
return fillBegin(enc, txnIsolation, timeout)
}
// RefImplCommitBody is reference implementation for filling of an commit
// request's body.
func RefImplCommitBody(enc *msgpack.Encoder) error {
return fillCommit(enc)
}
// RefImplRollbackBody is reference implementation for filling of an rollback
// request's body.
func RefImplRollbackBody(enc *msgpack.Encoder) error {
return fillRollback(enc)
}
// RefImplIdBody is reference implementation for filling of an id
// request's body.
func RefImplIdBody(enc *msgpack.Encoder, protocolInfo ProtocolInfo) error {
return fillId(enc, protocolInfo)
}
// RefImplWatchOnceBody is reference implementation for filling of an watchOnce
// request's body.
func RefImplWatchOnceBody(enc *msgpack.Encoder, key string) error {
return fillWatchOnce(enc, key)
}