tarantool

package module
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

README

Client in Go for Tarantool 2.0+

pipeline status coverage report

The tarantool package has everything necessary for interfacing with Tarantool 2.0+.

Table of contents

Installation

We assume that you have Tarantool version 2.0 and a modern Linux or BSD operating system.

To download and install, say:

$ go get gitlab.com/komex/tarantool

Example

We can now have a closer look at the example.go program and make some observations about what it does.

package main

import (
	"context"
	"fmt"
	"net"
	"time"

	"gitlab.com/komex/tarantool"
)

func main() {
	ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
	defer cancel()
	var conn *tarantool.Connection
	{
		c, err := net.Dial("tcp", ":3301")
		if err != nil {
			panic(err)
		}
		conn, err = tarantool.NewConnection(c)
		if err != nil {
			_ = c.Close()
			panic(err)
		}
	}
	defer conn.Close()

	// Use your tarantool credentials
	if err := conn.Auth(ctx, "admin", "passwd"); err != nil {
		panic(err)
	}

	spaces, err := conn.Spaces(ctx)
	if err != nil {
		panic(err)
	}

	space := spaces.ByName("tester")

	if space == nil {
		if err := createScheme(ctx, conn); err != nil {
			panic(err)
		}

		// Reload system info
		spaces, err = conn.Spaces(ctx)
		if err != nil {
			panic(err)
		}
		space = spaces.ByName("tester")

		// Insert three tuples (our name for records) into the space
		if err := conn.Exec(ctx, tarantool.NewInsert(space, []interface{}{1, "Roxette", 1986})); err != nil {
			panic(err)
		}
		if err := conn.Exec(ctx, tarantool.NewInsert(space, []interface{}{2, "Scorpions", 2015})); err != nil {
			panic(err)
		}
		if err := conn.Exec(ctx, tarantool.NewInsert(space, []interface{}{3, "Ace of Base", 1993})); err != nil {
			panic(err)
		}
	}

	// Select a tuple using the primary index
	single := tarantool.NewSingleResult(nil)
	if err := conn.Query(ctx, tarantool.NewSelect(space, tarantool.Key{3}, 1), single); err != nil {
		panic(err)
	}

	fmt.Println(single.Result)
}

func createScheme(ctx context.Context, conn *tarantool.Connection) error {
	// unsupported Lua type 'function'
	_ = conn.Exec(ctx, tarantool.NewCall("box.schema.space.create", "tester"))

	// Format the created space by specifying field names and types
	err := conn.Exec(ctx, tarantool.NewCall(
		"box.space.tester:format",
		[]map[string]string{
			{
				"name": "id",
				"type": "unsigned",
			},
			{
				"name": "band_name",
				"type": "string",
			},
			{
				"name": "year",
				"type": "unsigned",
			},
		},
	))
	if err != nil {
		return err
	}

	// Create the first index (named primary)
	err = conn.Exec(ctx, tarantool.NewCall(
		"box.space.tester:create_index",
		"primary",
		map[string]interface{}{
			"type":  "hash",
			"parts": []string{"id"},
		},
	))

	return err
}

Help

To contact go-tarantool developers on any problems, create an issue at komex/tarantool.

Documentation

Index

Constants

View Source
const (
	// Default size for the maximum number of requests sent at a time.
	DefaultSlotsSize = 255
	// Default size of connection buffer.
	DefaultBufferSize = 4096
)
View Source
const ExtUUID msgpack.Ext = 2

ExtUUID is a code of UUID extension.

Variables

View Source
var (
	ErrUnexpectedGreeting      = errors.New("unexpected tarantool server greeting message")
	ErrUnexpectedServerVersion = errors.New("unexpected tarantool server version")
	ErrNoConnectionSpecified   = errors.New("no connection was specified")
	ErrInvalidSaltSize         = errors.New("invalid salt size")
	ErrInvalidPackageSize      = errors.New("invalid package size")
	ErrTooMachResults          = errors.New("received too mach results")
	ErrGateInvalidState        = errors.New("gate has invalid state")
	ErrNotFound                = errors.New("was not found")
	ErrExchangeNotFound        = errors.WithMessage(ErrNotFound, "exchange")
	ErrSpaceNotFound           = errors.WithMessage(ErrNotFound, "space")
	ErrIndexNotFound           = errors.WithMessage(ErrNotFound, "index")
	ErrConnectionClosed        = errors.New("connection closed")
	ErrUnexpectedExtension     = errors.New("unexpected extension code")
)

Functions

func NextSyncSequenceValue added in v1.2.0

func NextSyncSequenceValue() uint64

NextSyncSequenceValue returns next unique sequence value.

func Skip added in v1.4.1

func Skip(dec *msgpack.Decoder, num int) error

Skip skips decoding of num elements.

Types

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

Auth provides authentication Query.

func NewAuth

func NewAuth(user, password string) *Auth

NewAuth returns a new instance of authentication Query.

func (Auth) Code

func (Auth) Code() Code

Code implements Query interface.

func (*Auth) EncodeMsgpack

func (a *Auth) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder interface.

type Call

type Call struct {
	// contains filtered or unexported fields
}

Call provides tarantool call/eval Query.

func NewCall

func NewCall(function string, arguments ...interface{}) *Call

NewCall returns a new call Query.

func NewEval

func NewEval(expression string, arguments ...interface{}) *Call

NewEval returns a new eval Query.

func (*Call) Code

func (c *Call) Code() Code

Code implements Query interface.

func (*Call) EncodeMsgpack

func (c *Call) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder interface.

type Code

type Code uint8

Code represents query type code.

const (
	CodeOK      Code = 0x00 // OK
	CodeSelect  Code = 0x01 // Select
	CodeInsert  Code = 0x02 // Insert
	CodeReplace Code = 0x03 // Replace
	CodeUpdate  Code = 0x04 // Update
	CodeDelete  Code = 0x05 // Delete
	CodeAuth    Code = 0x07 // Auth
	CodeEval    Code = 0x08 // Eval
	CodeUpsert  Code = 0x09 // Upsert
	CodeCall    Code = 0x0a // Call
	CodeExecute Code = 0x0b // Execute
	CodePrepare Code = 0x0d // Prepare
	CodePing    Code = 0x40 // Ping
)

func (*Code) DecodeMsgpack

func (i *Code) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements msgpack.CustomDecoder interface.

func (Code) EncodeMsgpack

func (i Code) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder interface.

func (Code) String added in v1.1.1

func (i Code) String() string

type Connection

type Connection struct {
	ProtocolVersion string
	SessionID       string
	// contains filtered or unexported fields
}

Connection allows to establish connection and communicates with Tarantool server.

func NewConnection

func NewConnection(conn net.Conn, options ...Option) (*Connection, error)

NewConnection returns a new instance of Connection.

func (*Connection) Auth

func (c *Connection) Auth(ctx context.Context, user, password string) error

Auth authenticates user by password and reload available spaces and indexes.

func (*Connection) Close

func (c *Connection) Close() error

Close closes connection.

func (*Connection) Exec

func (c *Connection) Exec(ctx context.Context, query Query) error

Exec executes a query and do not returns result.

func (*Connection) Indexes

func (c *Connection) Indexes(ctx context.Context) (Indexes, error)

Indexes returns a list of presented on a server indexes available to a user.

func (*Connection) Query

func (c *Connection) Query(ctx context.Context, query Query, result msgpack.CustomDecoder) error

Query executes a query and decodes response to result.

func (*Connection) Spaces

func (c *Connection) Spaces(ctx context.Context) (Spaces, error)

Spaces returns a list of presented on a server spaces available to a user.

type Decoder added in v1.4.0

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder is a structure for decoding response packet.

func NewDecoder added in v1.4.0

func NewDecoder(exchange *Exchange) *Decoder

NewDecoder returns a new instance of Decoder.

func (*Decoder) Fill added in v1.4.0

func (d *Decoder) Fill(r io.Reader, n uint64) error

Fill resets and fills buffer from r with n bytes.

func (*Decoder) Packet added in v1.4.0

func (d *Decoder) Packet() error

Packet decodes packet from buffer filled with Fill method.

type Delete

type Delete struct {
	Space *Space
	Index *Index
	Key   Key
}

Delete provides delete tuple Query.

func NewDelete

func NewDelete(space *Space, index *Index, key Key) *Delete

NewDelete returns a new instance of delete tuple Query.

func (Delete) Code

func (Delete) Code() Code

Code implements Query interface.

func (*Delete) EncodeMsgpack

func (d *Delete) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder interface.

type Driver added in v1.4.0

type Driver interface {
	// Auth authenticates user by password and reload available spaces and indexes.
	Auth(ctx context.Context, user, password string) error
	// Spaces returns a list of presented on a server spaces available to a user.
	Spaces(ctx context.Context) (Spaces, error)
	// Indexes returns a list of presented on a server indexes available to a user.
	Indexes(ctx context.Context) (Indexes, error)
	// Exec executes a query and do not returns result.
	Exec(ctx context.Context, query Query) error
	// Query executes a query and decodes response to result.
	Query(ctx context.Context, query Query, result msgpack.CustomDecoder) error
	// Close closes connection.
	Close() error
}

Driver is an interface for communicates with Tarantool Server.

type Error added in v1.2.0

type Error struct {
	Type    string
	File    string
	Line    uint
	Message string
	ErrNo   uint
	ErrCode uint
	Fields  map[string]interface{}
}

Error is a struct for error response from Tarantool Server.

func (*Error) DecodeMsgpack added in v1.2.0

func (e *Error) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements msgpack.CustomDecoder interface.

func (Error) Error added in v1.2.0

func (e Error) Error() string

Error implements error interface.

type ErrorCode added in v1.2.0

type ErrorCode uint8

ErrorCode represents error codes from Tarantool Server.

const (
	ErrorType    ErrorCode = 0x00
	ErrorFile    ErrorCode = 0x01
	ErrorLine    ErrorCode = 0x02
	ErrorMessage ErrorCode = 0x03
	ErrorErrNo   ErrorCode = 0x04
	ErrorErrCode ErrorCode = 0x05
	ErrorFields  ErrorCode = 0x06
)

type Exchange

type Exchange struct {
	// contains filtered or unexported fields
}

func NewExchange

func NewExchange(size int) *Exchange

NewExchange returns a new instance of Exchange.

func (*Exchange) Clear added in v1.4.0

func (e *Exchange) Clear(err error)

func (*Exchange) Pull added in v1.4.0

func (e *Exchange) Pull(id uint64) *Gate

func (*Exchange) Push added in v1.4.0

func (e *Exchange) Push(gate *Gate)

type Execute added in v1.2.0

type Execute struct {
	// contains filtered or unexported fields
}

Execute defines Tarantool execute query.

func NewExecute added in v1.2.0

func NewExecute(query string, arguments ...interface{}) *Execute

NewExecute creates a new instance of Execute query.

func (Execute) Code added in v1.2.0

func (Execute) Code() Code

Code implements interface Query.

func (*Execute) EncodeMsgpack added in v1.2.0

func (e *Execute) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements interface msgpack.CustomEncoder.

type Gate added in v1.4.0

type Gate struct {
	bytes.Buffer
	*msgpack.Encoder
	// contains filtered or unexported fields
}

Gate links query and response.

func NewGate added in v1.4.0

func NewGate(code Code, result msgpack.CustomDecoder) (*Gate, error)

NewGate returns a new instance of Gate. Each Gate MUST be Free() after usage.

func (*Gate) Free added in v1.4.0

func (g *Gate) Free()

Free frees resources and returns Gate to pool. This gate can't be used after invoking this method.

func (*Gate) ID added in v1.4.0

func (g *Gate) ID() uint64

ID returns an unique request-response ID.

func (*Gate) Wait added in v1.4.0

func (g *Gate) Wait(ctx context.Context) error

Wait blocks goroutine until fetch response.

type Header struct {
	Error   error
	Sync    uint64
	Scheme  uint64
	Code    Code
	HasData bool
}

Header represents Tarantool binary protocol message header.

func (*Header) DecodeMsgpack

func (h *Header) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements interface msgpack.CustomDecoder.

func (*Header) EncodeMsgpack

func (h *Header) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements interface msgpack.CustomEncoder.

func (*Header) Reset

func (h *Header) Reset()

Reset resets header values to default.

type Index

type Index struct {
	SpaceID uint
	ID      uint
	Name    string
	Type    string
}

Index defines Tarantool index object.

func GetIndex added in v1.4.0

func GetIndex(ctx context.Context, conn Driver, space *Space, name string) (*Index, error)

GetIndex finds an index by its name in specified space. Method returns ErrIndexNotFound if index was not found.

func (*Index) DecodeMsgpack

func (i *Index) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements interface msgpack.CustomDecoder.

func (*Index) EncodeMsgpack

func (i *Index) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements interface msgpack.CustomEncoder.

type Indexes

type Indexes []Index

Indexes define a list of Index.

func (Indexes) ByID

func (i Indexes) ByID(space *Space, id uint) *Index

ByID returns an index by its id.

func (Indexes) ByName

func (i Indexes) ByName(space *Space, name string) *Index

ByName returns an index by its name.

func (*Indexes) DecodeMsgpack

func (i *Indexes) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements interface msgpack.CustomDecoder.

type Insert

type Insert struct {
	Space   *Space
	Data    interface{}
	Replace bool
}

Insert defines Tarantool insert query.

func NewInsert

func NewInsert(space *Space, data interface{}) *Insert

NewInsert creates a new instance of Insert.

func NewReplace

func NewReplace(space *Space, data interface{}) *Insert

NewReplace creates a new instance of Insert with replace flag.

func (*Insert) Code

func (i *Insert) Code() Code

Code implements interface Query.

func (*Insert) EncodeMsgpack

func (i *Insert) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements interface msgpack.CustomEncoder.

type Iterator

type Iterator uint8
const (
	IterateEqual              Iterator = iota // key == x ASC order
	IterateReverseEqual                       // key == x DESC order
	IterateAll                                // all tuples
	IterateLessThan                           // key < x
	IterateLessThanOrEqual                    // key <= x
	IterateGreaterThan                        // key >= x
	IterateGreaterThanOrEqual                 // key > x
	IterateBitsAllSet                         // all bits from x are set in key
	IterateBitsAnySet                         // at least one x's bit is set
	IterateBitsAllNotSet                      // all bits are not set
)

type Key

type Key []interface{}

Key defines query key.

func (Key) EncodeMsgpack

func (k Key) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements interface msgpack.CustomEncoder.

type Operation

type Operation struct {
	// contains filtered or unexported fields
}

Operation defines Tarantool operation.

func BitAndOperation

func BitAndOperation(field, argument uint) Operation

func BitOrOperation

func BitOrOperation(field, argument uint) Operation

func BitXorOperation

func BitXorOperation(field, argument uint) Operation

func InsertOperation

func InsertOperation(beforeField uint, argument interface{}) Operation

func RemoveOperation

func RemoveOperation(field, num uint) Operation

func SetOperation

func SetOperation(field uint, argument interface{}) Operation

func SubOperation

func SubOperation(field uint, argument interface{}) Operation

func SumOperation

func SumOperation(field uint, argument interface{}) Operation

func (*Operation) EncodeMsgpack

func (o *Operation) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements interface msgpack.CustomEncoder.

type Operations added in v1.2.0

type Operations []Operation

Operations supports fast encoding slice of Operation in msgpack format.

func (Operations) EncodeMsgpack added in v1.2.0

func (o Operations) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder interface.

type Option added in v1.3.0

type Option func(*Options)

Option defines interface for configure Options.

func BufferSize added in v1.3.0

func BufferSize(size int) Option

BufferSize creates Option allows to set read and write buffer sizes.

func ReadBufferSize added in v1.3.0

func ReadBufferSize(size int) Option

ReadBufferSize creates Option allows to set read buffer size.

func SlotSize added in v1.3.0

func SlotSize(size int) Option

SlotSize creates Option allows to set maximum number of slots.

func WriteBufferSize added in v1.3.0

func WriteBufferSize(size int) Option

WriteBufferSize creates Option allows to set write buffer size.

type Options added in v1.3.0

type Options struct {
	// BufferSize allows to configure size of buffers.
	BufferSize struct {
		// Read defines a size of read buffer.
		Read int
		// Write defines a size of write buffer.
		Write int
	}
	// SlotsSize represents maximum number of slots.
	SlotsSize int
}

Options defines full list of supported options.

func DefaultOptions added in v1.3.0

func DefaultOptions() Options

DefaultOptions creates Options with default values.

type Ping

type Ping struct {
}

Ping defines Tarantool Ping query.

func NewPing

func NewPing() *Ping

NewPing creates a new instance of Ping.

func (Ping) Code

func (Ping) Code() Code

Code implements interface Query.

func (Ping) EncodeMsgpack

func (Ping) EncodeMsgpack(*msgpack.Encoder) error

EncodeMsgpack implements interface msgpack.CustomEncoder.

type Proto added in v1.3.0

type Proto uint8

Proto defines reserved codes in tarantool binary protocol.

const (
	ProtoCode         Proto = 0x00 // Code
	ProtoSync         Proto = 0x01 // Sync
	ProtoSchema       Proto = 0x05 // Schema
	ProtoSpaceNo      Proto = 0x10 // SpaceNo
	ProtoIndexNo      Proto = 0x11 // IndexNo
	ProtoLimit        Proto = 0x12 // Limit
	ProtoOffset       Proto = 0x13 // Offset
	ProtoIterator     Proto = 0x14 // Iterator
	ProtoKey          Proto = 0x20 // Key
	ProtoTuple        Proto = 0x21 // Tuple
	ProtoFunctionName Proto = 0x22 // FunctionName
	ProtoUserName     Proto = 0x23 // UserName
	ProtoExpression   Proto = 0x27 // Expression
	ProtoDefTuple     Proto = 0x28 // DefTuple
	ProtoData         Proto = 0x30 // Data
	ProtoError24      Proto = 0x31 // Error24
	ProtoMetaData     Proto = 0x32 // MetaData
	ProtoSQLBindMeta  Proto = 0x33 // SQLBindMeta
	ProtoSQLBindCount Proto = 0x34 // SQLBindCount
	ProtoSQLText      Proto = 0x40 // SQLText
	ProtoSQLBind      Proto = 0x41 // SQLBind
	ProtoSQLInfo      Proto = 0x42 // SQLInfo
	ProtoSQLStatement Proto = 0x43 // SQLStatement
	ProtoOptions      Proto = 0x2b // Options
	ProtoError        Proto = 0x52 // Error
)

func (*Proto) DecodeMsgpack added in v1.3.0

func (i *Proto) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements interface msgpack.CustomDecoder.

func (Proto) EncodeMsgpack added in v1.3.0

func (i Proto) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements interface msgpack.CustomEncoder.

func (Proto) String added in v1.3.0

func (i Proto) String() string

type Query

type Query interface {
	msgpack.CustomEncoder
	// Code returns Code of query.
	Code() Code
}

Query defines interface for all types of tarantool queries.

type QueryError added in v1.2.0

type QueryError struct {
	Query Query
	Err   error
}

QueryError is a wrapper for failed Query.

func NewQueryError added in v1.2.0

func NewQueryError(query Query, err error) *QueryError

NewQueryError creates a new instance of QueryError.

func (QueryError) Cause added in v1.3.0

func (q QueryError) Cause() error

Cause is useful for unwrapping origin error.

func (QueryError) Error added in v1.2.0

func (q QueryError) Error() string

Error implements error interface.

func (QueryError) Unwrap added in v1.2.0

func (q QueryError) Unwrap() error

Unwrap is useful for unwrapping origin error.

type Select

type Select struct {
	Space    *Space
	Index    *Index
	Iterator Iterator
	Key      Key
	Limit    uint
	Offset   uint
}

Select defines Tarantool select query.

func NewSelect

func NewSelect(space *Space, key Key, limit uint) *Select

NewSelect creates a new instance of Select.

func (Select) Code

func (Select) Code() Code

Code implements interface Query.

func (*Select) EncodeMsgpack

func (s *Select) EncodeMsgpack(enc *msgpack.Encoder) (err error)

EncodeMsgpack implements interface msgpack.CustomEncoder.

type SingleResult added in v1.2.0

type SingleResult struct {
	// contains filtered or unexported fields
}

SingleResult helps to decode single response to Result.

func NewSingleResult added in v1.2.0

func NewSingleResult(dec msgpack.CustomDecoder) *SingleResult

NewSingleResult returns a new instance of SingleResult.

func (*SingleResult) DecodeMsgpack added in v1.2.0

func (s *SingleResult) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements interface msgpack.CustomDecoder.

type Space

type Space struct {
	ID          uint
	Owner       uint
	Name        string
	Engine      string
	FieldsCount uint
}

Space defines Tarantool space object.

func GetSpace added in v1.4.0

func GetSpace(ctx context.Context, conn Driver, name string) (*Space, error)

GetSpace finds a space by its name. Method returns ErrSpaceNotFound if space was not found.

func (*Space) DecodeMsgpack

func (s *Space) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements interface msgpack.CustomDecoder.

func (*Space) EncodeMsgpack

func (s *Space) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements interface msgpack.CustomEncoder.

type Spaces

type Spaces []Space

Spaces define a list of Space.

func (Spaces) ByID

func (s Spaces) ByID(id uint) *Space

ByID returns a space by its id.

func (Spaces) ByName

func (s Spaces) ByName(name string) *Space

ByName returns a space by its name.

func (*Spaces) DecodeMsgpack

func (s *Spaces) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements interface msgpack.CustomDecoder.

type UUID added in v1.5.2

type UUID uuid.UUID

UUID represents wrapper for uuid.UUID with implemented msgpack.CustomDecoder and msgpack.CustomEncoder interfaces.

func (*UUID) DecodeMsgpack added in v1.5.2

func (u *UUID) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements msgpack.CustomDecoder interface.

func (UUID) EncodeMsgpack added in v1.5.2

func (u UUID) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder interface.

type Update

type Update struct {
	Space      *Space
	Index      *Index
	Key        Key
	Operations Operations
}

Update defines Tarantool update query.

func NewUpdate

func NewUpdate(space *Space, index *Index, key Key, operations Operations) *Update

NewUpdate creates a new instance of Update.

func (Update) Code

func (Update) Code() Code

Code implements interface Query.

func (*Update) EncodeMsgpack

func (u *Update) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements interface Query.

type Upsert

type Upsert struct {
	Space      *Space
	Data       interface{}
	Operations Operations
}

Upsert defines Tarantool upsert query.

func NewUpsert

func NewUpsert(space *Space, data interface{}, operations Operations) *Upsert

NewUpsert creates a new instance of Upsert.

func (Upsert) Code

func (Upsert) Code() Code

Code implements interface Query.

func (*Upsert) EncodeMsgpack

func (u *Upsert) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements interface Query.

type Wrapper added in v1.4.0

type Wrapper struct {
	Result interface{}
}

Wrapper wraps Result receiver and allows to decode it.

func NewWrapper added in v1.4.0

func NewWrapper(result interface{}) *Wrapper

NewWrapper creates a new instance of Wrapper.

func (*Wrapper) DecodeMsgpack added in v1.4.0

func (w *Wrapper) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements interface msgpack.CustomDecoder.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL