Documentation
¶
Overview ¶
Example ¶
// Run Tarantool Enterprise Edition instance before example execution: // // Terminal 1: // $ cd arrow // $ TEST_TNT_WORK_DIR=$(mktemp -d -t 'tarantool.XXX') tarantool testdata/config-memcs.lua // // Terminal 2: // $ go test -v example_test.go package main import ( "context" "encoding/hex" "fmt" "log" "time" "github.com/tarantool/go-tarantool/v2" "github.com/tarantool/go-tarantool/v2/arrow" ) var arrowBinData, _ = hex.DecodeString("ffffffff70000000040000009effffff0400010004000000" + "b6ffffff0c00000004000000000000000100000004000000daffffff140000000202" + "000004000000f0ffffff4000000001000000610000000600080004000c0010000400" + "080009000c000c000c0000000400000008000a000c00040006000800ffffffff8800" + "0000040000008affffff0400030010000000080000000000000000000000acffffff" + "01000000000000003400000008000000000000000200000000000000000000000000" + "00000000000000000000000000000800000000000000000000000100000001000000" + "0000000000000000000000000a00140004000c0010000c0014000400060008000c00" + "00000000000000000000") func main() { dialer := tarantool.NetDialer{ Address: "127.0.0.1:3013", User: "test", Password: "test", } ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond) client, err := tarantool.Connect(ctx, dialer, tarantool.Opts{}) cancel() if err != nil { log.Fatalf("Failed to connect: %s", err) } arr, err := arrow.MakeArrow(arrowBinData) if err != nil { log.Fatalf("Failed prepare Arrow data: %s", err) } req := arrow.NewInsertRequest("testArrow", arr) resp, err := client.Do(req).Get() if err != nil { log.Fatalf("Failed insert Arrow: %s", err) } if len(resp) > 0 { log.Fatalf("Unexpected response") } else { fmt.Printf("Batch arrow inserted") } }
Index ¶
- type Arrow
- type InsertRequest
- func (r *InsertRequest) Arrow(arrow Arrow) *InsertRequest
- func (r *InsertRequest) Async() bool
- func (r *InsertRequest) Body(res tarantool.SchemaResolver, enc *msgpack.Encoder) error
- func (r *InsertRequest) Context(ctx context.Context) *InsertRequest
- func (r *InsertRequest) Ctx() context.Context
- func (r *InsertRequest) Response(header tarantool.Header, body io.Reader) (tarantool.Response, error)
- func (r *InsertRequest) Type() iproto.Type
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Arrow ¶
type Arrow struct {
// contains filtered or unexported fields
}
Arrow struct wraps a raw arrow data buffer.
type InsertRequest ¶
type InsertRequest struct {
// contains filtered or unexported fields
}
InsertRequest helps you to create an insert request object for execution by a Connection.
func NewInsertRequest ¶
func NewInsertRequest(space interface{}, arrow Arrow) *InsertRequest
NewInsertRequest returns a new InsertRequest.
func (*InsertRequest) Arrow ¶
func (r *InsertRequest) Arrow(arrow Arrow) *InsertRequest
Arrow sets the arrow for insertion the insert arrow request. Note: default value is nil.
func (*InsertRequest) Async ¶
func (r *InsertRequest) Async() bool
Async returns false to the request return a response.
func (*InsertRequest) Body ¶
func (r *InsertRequest) Body(res tarantool.SchemaResolver, enc *msgpack.Encoder) error
Body fills an msgpack.Encoder with the insert arrow request body.
func (*InsertRequest) Context ¶
func (r *InsertRequest) Context(ctx context.Context) *InsertRequest
Context sets a passed context to the request.
Pay attention that when using context with request objects, the timeout option for Connection does not affect the lifetime of the request. For those purposes use context.WithTimeout() as the root context.
func (*InsertRequest) Ctx ¶
func (r *InsertRequest) Ctx() context.Context
Ctx returns a context of the request.
func (*InsertRequest) Response ¶
func (r *InsertRequest) Response( header tarantool.Header, body io.Reader, ) (tarantool.Response, error)
Response creates a response for the InsertRequest.
func (*InsertRequest) Type ¶
func (r *InsertRequest) Type() iproto.Type
Type returns a IPROTO_INSERT_ARROW type for the request.