forked from fl00r/go-tarantool-1.6
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathlen.go
58 lines (46 loc) · 1.33 KB
/
len.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
package crud
import (
"context"
"github.com/vmihailenco/msgpack/v5"
"github.com/tarantool/go-tarantool/v2"
)
// LenResult describes result for `crud.len` method.
type LenResult = NumberResult
// LenOpts describes options for `crud.len` method.
type LenOpts = BaseOpts
// LenRequest helps you to create request object to call `crud.len`
// for execution by a Connection.
type LenRequest struct {
spaceRequest
opts LenOpts
}
type lenArgs struct {
_msgpack struct{} `msgpack:",asArray"` //nolint: structcheck,unused
Space string
Opts LenOpts
}
// MakeLenRequest returns a new empty LenRequest.
func MakeLenRequest(space string) LenRequest {
req := LenRequest{}
req.impl = newCall("crud.len")
req.space = space
req.opts = LenOpts{}
return req
}
// Opts sets the options for the LenRequest request.
// Note: default value is nil.
func (req LenRequest) Opts(opts LenOpts) LenRequest {
req.opts = opts
return req
}
// Body fills an encoder with the call request body.
func (req LenRequest) Body(res tarantool.SchemaResolver, enc *msgpack.Encoder) error {
args := lenArgs{Space: req.space, 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 LenRequest) Context(ctx context.Context) LenRequest {
req.impl = req.impl.Context(ctx)
return req
}