forked from fl00r/go-tarantool-1.6
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathmin.go
64 lines (52 loc) · 1.49 KB
/
min.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
package crud
import (
"context"
"github.com/vmihailenco/msgpack/v5"
"github.com/tarantool/go-tarantool/v2"
)
// MinOpts describes options for `crud.min` method.
type MinOpts = BorderOpts
// MinRequest helps you to create request object to call `crud.min`
// for execution by a Connection.
type MinRequest struct {
spaceRequest
index interface{}
opts MinOpts
}
type minArgs struct {
_msgpack struct{} `msgpack:",asArray"` //nolint: structcheck,unused
Space string
Index interface{}
Opts MinOpts
}
// MakeMinRequest returns a new empty MinRequest.
func MakeMinRequest(space string) MinRequest {
req := MinRequest{}
req.impl = newCall("crud.min")
req.space = space
req.opts = MinOpts{}
return req
}
// Index sets the index name/id for the MinRequest request.
// Note: default value is nil.
func (req MinRequest) Index(index interface{}) MinRequest {
req.index = index
return req
}
// Opts sets the options for the MinRequest request.
// Note: default value is nil.
func (req MinRequest) Opts(opts MinOpts) MinRequest {
req.opts = opts
return req
}
// Body fills an encoder with the call request body.
func (req MinRequest) Body(res tarantool.SchemaResolver, enc *msgpack.Encoder) error {
args := minArgs{Space: req.space, Index: req.index, Opts: req.opts}
req.impl = req.impl.Args(args)
return req.impl.Body(res, enc)
}
// Context sets a passed context to CRUD request.
func (req MinRequest) Context(ctx context.Context) MinRequest {
req.impl = req.impl.Context(ctx)
return req
}