Migration guide

June 8, 2026 · View on GitHub

Migration from v2.x.x to v3.x.x

Major changes

  • Required Go version is 1.24 now.
  • Import path changed from github.com/tarantool/go-tarantool/v2 to github.com/tarantool/go-tarantool/v3.
  • Future is an interface now (was a concrete struct). All code that depends on the concrete *Future type must be updated to use the Future interface.
  • All request types use value receivers and constructors return values instead of pointers. Builder methods return modified copies instead of mutating in place.
  • Response interface has a new Release() method. Any custom implementations must be updated.
  • Replaced custom Logger interface with *slog.Logger from the standard library.
  • Removed deprecated Connection and Connector methods. Use Do() with request types instead.
  • Removed deprecated pool methods. Use Do() with request types instead.
  • Removed box.session.push() support: Future.AppendPush() and Future.GetIterator() methods, ResponseIterator and TimeoutResponseIterator types, PushResponse type.
  • Renamed value constructors from Make* to New* for naming consistency across the connector.
  • Pool.Close() and Pool.CloseGraceful() return a single error instead of []error.
  • Pool types and constants renamed for consistency.

Main package

Import path

The module path changed from github.com/tarantool/go-tarantool/v2 to github.com/tarantool/go-tarantool/v3. All import statements must be updated:

// Before.
import "github.com/tarantool/go-tarantool/v2"

// After.
import "github.com/tarantool/go-tarantool/v3"

The same applies to all subpackages (pool, box, crud, decimal, datetime, uuid, arrow, settings, queue, test_helpers).

Go version

Required Go version is updated from 1.20 to 1.24.

Future type

Future is now an interface instead of a concrete struct. The unexported future struct implements it. This affects type assertions, variable declarations, and any code that directly constructed Future values.

  • Doer.Do() and Connection.Do() now return Future (interface) instead of *Future.
  • Stream.Do() returns Future instead of *Future.
  • Future.Release() is a new method that frees resources allocated for the Future object. Call it when the future is no longer needed to allow buffer reuse.
  • Future.done replaced with Future.cond (sync.Cond) + Future.finished bool internally. Future.SetResponse() and Future.SetError() are unexported now (use NewFutureWithErr / NewFutureWithResponse).
  • Removed Future.AppendPush(), Future.GetIterator(), Future.SetResponse(), Future.SetError() methods.
  • Future.Get() return type changed from []interface{} to []any.
  • Future.GetTyped() parameter type changed from interface{} to any.

New factory functions replace direct construction:

FunctionDescription
NewFutureWithErr(req Request, err error) FutureCreates a future with a pre-set error
NewFutureWithResponse(req Request, header Header, body io.Reader) (Future, error)Creates a future with a pre-set response

Request types

All request types now use value receivers and constructors return values instead of pointers. Builder methods return modified copies instead of mutating in place.

Breaking: calling a builder method without using its return value silently discards the change:

// Before (pointer receivers, mutation in place).
req := NewSelectRequest("space")
req.Index("idx")           // Mutated req directly.
conn.Do(req)

// After (value receivers, must use return value).
req := NewSelectRequest("space")
req = req.Index("idx")     // Must reassign.
conn.Do(req)

// Or chain directly.
conn.Do(NewSelectRequest("space").Index("idx"))

Constructor return types changed for all request types:

BeforeAfter
NewPingRequest() *PingRequestNewPingRequest() PingRequest
NewSelectRequest(space) *SelectRequestNewSelectRequest(space) SelectRequest
NewInsertRequest(space) *InsertRequestNewInsertRequest(space) InsertRequest
NewReplaceRequest(space) *ReplaceRequestNewReplaceRequest(space) ReplaceRequest
NewDeleteRequest(space) *DeleteRequestNewDeleteRequest(space) DeleteRequest
NewUpdateRequest(space) *UpdateRequestNewUpdateRequest(space) UpdateRequest
NewUpsertRequest(space) *UpsertRequestNewUpsertRequest(space) UpsertRequest
NewCallRequest(func) *CallRequestNewCallRequest(func) CallRequest
NewEvalRequest(expr) *EvalRequestNewEvalRequest(expr) EvalRequest
NewExecuteRequest(expr) *ExecuteRequestNewExecuteRequest(expr) ExecuteRequest
NewWatchOnceRequest(key) *WatchOnceRequestNewWatchOnceRequest(key) WatchOnceRequest
NewPrepareRequest(expr) *PrepareRequestNewPrepareRequest(expr) PrepareRequest
NewUnprepareRequest(stmt) *UnprepareRequestNewUnprepareRequest(stmt) UnprepareRequest
NewExecutePreparedRequest(stmt) *ExecutePreparedRequestNewExecutePreparedRequest(stmt) ExecutePreparedRequest
NewBeginRequest() *BeginRequestNewBeginRequest() BeginRequest
NewCommitRequest() *CommitRequestNewCommitRequest() CommitRequest
NewRollbackRequest() *RollbackRequestNewRollbackRequest() RollbackRequest
NewBroadcastRequest(key) *BroadcastRequestNewBroadcastRequest(key) BroadcastRequest

Removed deprecated NewCall16Request and NewCall17Request constructors. Use NewCallRequest instead. NewCallRequest uses IPROTO_CALL, which has been the default since Tarantool 1.7.2.

Removed intermediate spaceRequest and spaceIndexRequest types. The space and index fields are now inlined directly into each request struct.

In the box subpackage, request types (InfoRequest, UserExistsRequest, UserCreateRequest, SessionSuRequest, etc.) no longer embed tarantool.CallRequest. They store it as a private field and implement their own Context() method returning the wrapper type. Usage stays clean:

req := box.NewUserExistsRequest(username).Context(ctx)

BroadcastRequest.Code() method renamed to BroadcastRequest.Type() for consistency with the Request interface.

The same value-receiver pattern was applied to arrow.InsertRequest and settings.SetRequest/settings.GetRequest.

Response interface

  • Response.Release() is a new method added to the Response interface. Any custom implementations must be updated. Call Release() to free resources allocated for a response (buffers, etc.).
  • SelectResponse.Release(), ExecuteResponse.Release(), PrepareResponse.Release() — new methods that return response buffers to internal sync.Pool for reuse.
  • SelectResponse.Pos(), ExecuteResponse.MetaData(), ExecuteResponse.SQLInfo() — now properly return errors from implicit Decode() calls (previously errors were silently discarded).
  • Response.Decode() return type changed from []interface{} to []any.
  • Response.DecodeTyped() parameter type changed from interface{} to any.
  • Removed PushResponse type.
  • Removed ResponseIterator and TimeoutResponseIterator interfaces.

Logger

Replaced custom Logger interface with *slog.Logger from the standard library. The Logger interface, ConnLogKind type, and its constants are removed. Use Opts.Logger *slog.Logger instead. Pool Opts.Logger *slog.Logger replaces direct log.Printf calls. By default, logs are discarded (silent).

Before:

type MyLogger struct{}

func (l MyLogger) Report(event tarantool.ConnLogKind, conn *tarantool.Connection, v ...any) {
    switch event {
    case tarantool.LogReconnectFailed:
        reconnects := v[0].(uint)
        err := v[1].(error)
        log.Printf("reconnect %d failed: %s", reconnects, err)
    // ... other cases.
    }
}

opts := tarantool.Opts{
    Logger: MyLogger{},
}

After:

import "log/slog"

opts := tarantool.Opts{
    Logger: slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
        Level: slog.LevelWarn,
    })),
}

For pool:

poolOpts := pool.Opts{
    CheckTimeout: time.Second,
    Logger: slog.New(slog.NewTextHandler(os.Stderr, nil)),
}
connPool, err := pool.NewWithOpts(ctx, instances, poolOpts)

Removed types and constants:

RemovedReplacement
Logger interface*slog.Logger in Opts.Logger
ConnLogKind typeString constants (e.g., LogMsgReconnectFailed)
LogReconnectFailedLogMsgReconnectFailed
LogLastReconnectFailedLogMsgLastReconnectFailed
LogUnexpectedResultIdLogMsgUnexpectedRequestId
LogWatchEventReadFailedLogMsgWatchEventReadFailed
LogAppendPushFailedLogMsgPushUnsupported
LogBoxSessionPushUnsupportedLogMsgPushUnsupported
defaultLogger typeDiscarded by default (previously logged to stderr via log.Printf)

Note about log groups: connection log messages appear under the tarantool group, while pool-level log messages appear under the tarantool.pool group. When a pool logger is set and a connection does not have its own logger, the pool passes its logger to each connection, which then applies its own WithGroup("tarantool").

Stream type

Stream struct fields Id and Conn are unexported (id and conn), making Stream an opaque handle. The stream identifier and the underlying connection are internal details; callers should hold their own *Connection reference if they need it.

Before:

stream, _ := conn.NewStream()
log.Printf("opened stream %d on %v", stream.Id, stream.Conn)

After:

stream, _ := conn.NewStream()
log.Printf("opened stream on %v", conn)

Removed deprecated methods

All previously-deprecated synchronous and async helper methods are removed from Connection, Connector interface, and Pooler interface. Use Do() with the corresponding request type instead.

Removed from Connection and Connector:

Ping, Select, Insert, Replace, Delete, Update, Upsert, Call, Call16, Call17, Eval, Execute, GetTyped, SelectTyped, InsertTyped, ReplaceTyped, DeleteTyped, UpdateTyped, CallTyped, Call16Typed, Call17Typed, EvalTyped, ExecuteTyped, SelectAsync, InsertAsync, ReplaceAsync, DeleteAsync, UpdateAsync, UpsertAsync, CallAsync, Call16Async, Call17Async, EvalAsync, ExecuteAsync.

NOTE: to substitute Connection.GetTyped() for a single-tuple select, use the following pattern:

// Before.
var singleTpl Tuple
err = conn.GetTyped(space, index, key, &singleTpl)

// After.
var tpl []Tuple
err = conn.Do(NewSelectRequest(space).
    Index(index).
    Limit(1).
    Key(key),
).GetTyped(&tpl)
singleTpl := tpl[0]

Context cancellation

When a context is canceled, the error returned now wraps ctx.Cause(). This allows you to check the original cancellation reason using errors.Is / errors.As:

ctx, cancel := context.WithCancelCause(ctx)
cancel(errors.New("my reason"))
_, err := conn.Do(req).Get()
// Err now wraps the cause.
errors.Is(err, context.Canceled) // Still true.
// And you can retrieve the original cause.
errors.Is(err, context.Cause(ctx)) // True.

Allocator

A new Allocator interface allows custom allocation of response buffers. This is useful for reducing GC pressure in high-throughput scenarios.

type Allocator interface {
    Get(length int) *[]byte
    Put(buf *[]byte)
}

PoolAllocator implements Allocator using sync.Pool for power-of-two sized byte slices:

alloc, _ := tarantool.NewPoolAllocator([]int{10, 11, 12, 13})
opts := tarantool.Opts{
    Allocator: alloc,
}

Opts.Allocator is a new optional field. If not set, the standard Go allocation is used (same as v2 behavior).

Miscellaneous

  • RLimitActions type renamed to RLimitAction (typo fix).
  • Opts.Handle field type changed from interface{} to any.
  • BoxError.Fields field type changed from map[string]interface{} to map[string]any.
  • WatchEvent.Value field type changed from interface{} to any.
  • SchemaResolver.ResolveSpace() parameter changed from interface{} to any.
  • SchemaResolver.ResolveIndex() parameter changed from interface{} to any.
  • EncodeSpace() parameter changed from interface{} to any.
  • KeyValueBind.Value field type changed from interface{} to any.
  • New OptionalBoxError type for optional BoxError values (compatible with the go-option library).
  • New LogKeyAttempt, LogKeyMaxAttempts, LogKeyError, LogKeyRequestId, LogKeyAddress string constants for structured log attribute keys.

pool package

  • ConnectionPool type renamed to Pool.
  • ConnectionHandler interface renamed to Handler.
  • ConnectionInfo type renamed to Info, field ConnRole renamed to Role.
  • ConnectionPoolOpts type renamed to Opts.
  • Pool.GetInfo() renamed to Pool.Info().
  • Pool.DoInstance() renamed to Pool.DoOn().
  • pool.Connect() renamed to pool.New(), pool.ConnectWithOpts() renamed to pool.NewWithOpts().

Enum constants renamed to use prefix:

BeforeAfter
ANYModeAny
RWModeRW
ROModeRO
PreferRWModePreferRW
PreferROModePreferRO
UnknownRoleRoleUnknown
MasterRoleRoleMaster
ReplicaRoleRoleReplica
  • Pool.Close() and Pool.CloseGraceful() now return a single error instead of []error. Multiple errors are combined using errors.Join().

  • Pooler interface updated: Close() error, CloseGraceful() error, Do(req Request, mode Mode) Future (was *tarantool.Future).

  • pool.New(), pool.NewWithOpts() and Pool.Add() now return an error if tarantool.Opts.Reconnect, tarantool.Opts.MaxReconnects or tarantool.Opts.Notify options are set for an instance connection. These options create conflicts with the pool's own reconnection logic: the pool reconnects via pool.Opts.CheckTimeout, so an internal Reconnect creates a race with the pool; MaxReconnects permanently closes a Connection while the pool would create a new one; Notify events from an individual connection are misleading in a pool context (e.g., Disconnected does not mean the endpoint is unavailable). Use pool.Handler to track endpoint availability. All validation errors are combined using errors.Join and can be checked with errors.Is.

    Before:

    opts := tarantool.Opts{
        Reconnect:     time.Second,
        MaxReconnects: 3,
        Notify:        make(chan tarantool.ConnEvent),
    }
    connPool, err := pool.ConnectWithOpts(ctx, instances, poolOpts)
    

    After:

    opts := tarantool.Opts{
        // Reconnect, MaxReconnects, Notify must not be set.
    }
    poolOpts := pool.Opts{
        CheckTimeout: time.Second,
        Handler:      myHandler, // Implement pool.Handler.
    }
    connPool, err := pool.NewWithOpts(ctx, instances, poolOpts)
    
  • pool.ConnectionPool renamed to pool.Pool.

  • pool.ConnectionHandler renamed to pool.Handler.

  • pool.ConnectionInfo renamed to pool.Info, field ConnRole renamed to Role.

  • pool.Pool.GetInfo() renamed to pool.Pool.Info().

  • pool.Pool.DoInstance() renamed to pool.Pool.DoOn().

  • pool.Connect() renamed to pool.New(), pool.ConnectWithOpts() renamed to pool.NewWithOpts().

  • pool enum constants renamed to use prefix: ANYModeAny, RWModeRW, ROModeRO, PreferRWModePreferRW, PreferROModePreferRO, UnknownRoleRoleUnknown, MasterRoleRoleMaster, ReplicaRoleRoleReplica.

  • Error types redesigned around Go's errors.Is / errors.As (#469):

    • tarantool.Error (server-side error wrapper) renamed to tarantool.ServerError.

    • ClientError.Code is now typed as iproto.Error (same numeric values as the old uint32 constants), matching ServerError.Code.

    • ClientError.Temporary() removed. Use tarantool.IsRetryableError(err) or errors.Is(err, tarantool.ErrRetryable).

    • The seven legacy uint32 constants are now package-level error sentinels matched via errors.Is. Numeric forms remain available as tarantool.Code* constants:

      Old (uint32 constant)New sentinelNumeric (iproto.Error)
      ErrConnectionNotReadyErrConnectionNotReadyCodeConnectionNotReady
      ErrConnectionClosedErrConnectionClosedCodeConnectionClosed
      ErrProtocolErrorErrProtocolErrorCodeProtocolError
      ErrTimeoutedErrTimeoutedCodeTimeouted
      ErrRateLimitedErrRateLimitedCodeRateLimited
      ErrConnectionShutdownErrConnectionShutdownCodeConnectionShutdown
      ErrIoErrorErrIoErrorCodeIoError
    • ClientError gained a Cause error field; I/O failures wrap their underlying net-layer error and can be inspected with errors.As.

    • ClientError.Error() now formats as "<sentinel-message>: <Msg>: <cause>" (omitting empty parts).

    Before:

    if clientErr, ok := err.(tarantool.ClientError); ok {
        if clientErr.Code == tarantool.ErrConnectionClosed {
            // ...
        }
        if clientErr.Temporary() {
            // retry
        }
    }
    var tntErr tarantool.Error
    if errors.As(err, &tntErr) { /* ... */ }
    

    After:

    if errors.Is(err, tarantool.ErrConnectionClosed) {
        // ...
    }
    if tarantool.IsRetryableError(err) {
        // retry
    }
    var tntErr tarantool.ServerError
    if errors.As(err, &tntErr) { /* ... */ }
    
  • Future.Release() call could be used to free resources allocated for the Future object created by a Connection object.

  • Removed deprecated NewCall16Request and NewCall17Request constructors. Use NewCallRequest instead. NewCallRequest uses IPROTO_CALL, which has been the default since Tarantool 1.7.2.

  • New T interface added to allow test helpers to be used in example functions, benchmarks, and custom test frameworks. *testing.T satisfies this interface automatically, so existing code continues to work without changes.

    type T interface {
        Helper()
        Errorf(format string, args ...any)
        Fatalf(format string, args ...any)
        Skipf(format string, args ...any)
        FailNow()
    }
    

    All functions in test_helpers that previously accepted *testing.T now accept the T interface instead, making them usable in broader contexts like example functions and custom test runners.

  • MockDoer is now an interface instead of a struct. Use NewMockDoer(t) to create an instance, then chain AddResponseRaw(), AddResponseError(), AddResponse() to configure responses. The Requests field is now a method Requests() that returns recorded requests.

    Before:

    mock := test_helpers.NewMockDoer(t,
        test_helpers.NewMockResponse(t, []any{"data"}),
        errors.New("some error"),
    )
    requests := mock.Requests
    

    After:

    mock := test_helpers.NewMockDoer(t).
        AddResponseRaw([]any{"data"}).
        AddResponseError(errors.New("some error"))
    requests := mock.Requests()
    
  • test_helpers.CheckPoolStatuses and test_helpers.ProcessListenOnInstance now accept typed arguments (CheckStatusesArgs and ListenOnInstanceArgs respectively) instead of interface{}.

  • New test_helpers.ExecuteOnAll function to execute operations on all instances in parallel with context support.

  • New test_helpers.DumpLogsIfFailed(t, inst) helper that prints captured tarantool logs via t.Logf when the test failed.

  • New (*TarantoolInstance).LogTail() method that returns the last 50 lines of captured tarantool stdout/stderr.

  • Removed test_helpers.Retry function. Use assert.Eventually from testify instead.

Migration from v1.x.x to v2.x.x

Major changes

  • The go_tarantool_call_17 build tag is no longer needed, since by default the CallRequest is Call17Request.
  • The go_tarantool_msgpack_v5 build tag is no longer needed, since only the msgpack/v5 library is used.
  • The go_tarantool_ssl_disable build tag is no longer needed, since the connector is no longer depends on OpenSSL by default. You could use the external library go-tlsdialer to create a connection with the ssl transport.
  • Required Go version is 1.20 now.
  • The Connect function became more flexible. It now allows to create a connection with cancellation and a custom Dialer implementation.
  • It is required to use Request implementation types with the Connection.Do method instead of Connection.<Request> methods.
  • The connection_pool package renamed to pool.

The basic code for the v1.12.2 release:

package tarantool

import (
	"fmt"

	"github.com/tarantool/go-tarantool"
	_ "github.com/tarantool/go-tarantool/v2/datetime"
	_ "github.com/tarantool/go-tarantool/v2/decimal"
	_ "github.com/tarantool/go-tarantool/v2/uuid"
)

func main() {
	opts := tarantool.Opts{User: "guest"}
	conn, err := tarantool.Connect("127.0.0.1:3301", opts)
	if err != nil {
		fmt.Println("Connection refused:", err)
		return
	}

	resp, err := conn.Insert(999, []interface{}{99999, "BB"})
	if err != nil {
		fmt.Println("Error:", err)
		fmt.Println("Code:", resp.Code)
	} else {
		fmt.Println("Data:", resp.Data)
	}
}

At now became:

package tarantool

import (
	"context"
	"fmt"
	"time"

	"github.com/tarantool/go-tarantool/v2"
	_ "github.com/tarantool/go-tarantool/v2/datetime"
	_ "github.com/tarantool/go-tarantool/v2/decimal"
	_ "github.com/tarantool/go-tarantool/v2/uuid"
)

func main() {
	ctx, cancel := context.WithTimeout(context.Background(), time.Second)
	defer cancel()
	dialer := tarantool.NetDialer{
		Address: "127.0.0.1:3301",
		User: 	 "guest",
	}
	opts := tarantool.Opts{
		Timeout: time.Second,
	}

	conn, err := tarantool.Connect(ctx, dialer, opts)
	if err != nil {
		fmt.Println("Connection refused:", err)
		return
	}

	data, err := conn.Do(
		tarantool.NewInsertRequest(999).Tuple([]interface{}{99999, "BB"})).Get()
	if err != nil {
		fmt.Println("Error:", err)
	} else {
		fmt.Println("Data:", data)
	}
}

Main package

Go version

Required Go version is updated from 1.13 to 1.20.

msgpack/v5

At now the msgpack/v5 library is used for the msgpack encoding/decondig.

Most function names and argument types in msgpack/v5 and msgpack.v2 have not changed (in our code, we noticed changes in EncodeInt, EncodeUint and RegisterExt). But there are a lot of changes in a logic of encoding and decoding. On the plus side the migration seems easy, but on the minus side you need to be very careful.

First of all, EncodeInt8, EncodeInt16, EncodeInt32, EncodeInt64 and EncodeUint* analogues at msgpack/v5 encode numbers as is without loss of type. In msgpack.v2 the type of a number is reduced to a value.

Secondly, a base decoding function does not convert numbers to int64 or uint64. It converts numbers to an exact type defined by MessagePack. The change makes manual type conversions much more difficult and can lead to runtime errors with an old code. We do not recommend to use type conversions and give preference to *Typed functions (besides, it's faster).

There are also changes in the logic that can lead to errors in the old code, as example. Although in msgpack/v5 some functions for the logic tuning were added (see UseLooseInterfaceDecoding, UseCompactInts etc), it is still impossible to achieve full compliance of behavior between msgpack/v5 and msgpack.v2. So we don't go this way. We use standard settings if it possible.

Call = Call17

Call requests uses IPROTO_CALL instead of IPROTO_CALL_16.

So now NewCallRequest uses IPROTO_CALL. A result of the request is an array instead of array of arrays.

IPROTO constants

  • IPROTO constants have been moved to a separate package go-iproto.
  • PushCode constant is removed. To check whether the current response is a push response, use IsPush() method of the response iterator instead.
  • ErrorNo constant is added to indicate that no error has occurred while getting the response. It should be used instead of the removed OkCode. See ExampleErrorNo.

Request interface

  • The method Code() uint32 replaced by the Type() iproto.Type.
  • Response method added to the Request interface.

Request changes

  • Requests Update, UpdateAsync, UpdateTyped, Upsert, UpsertAsync no longer accept ops argument (operations) as an interface{}. *Operations needs to be passed instead.
  • Op struct for update operations made private.
  • Removed OpSplice struct.
  • Operations.Splice method now accepts 5 arguments instead of 3.
  • UpdateRequest and UpsertRequest structs no longer accept interface{} for an ops field. *Operations needs to be used instead.

Response interface

  • Response is now an interface.
  • Response header stored in a new Header struct. It could be accessed via Header() method.

Response changes

  • ResponseIterator interface now has IsPush() method. It returns true if the current response is a push response.
  • For each request type, a different response type is created. They all implement a Response interface. SelectResponse, PrepareResponse, ExecuteResponse, PushResponse are a part of a public API. Pos(), MetaData(), SQLInfo() methods created for them to get specific info. Special types of responses are used with special requests.

Future type

  • Method Get now returns response data instead of the actual response.
  • New method GetResponse added to get an actual response.
  • Future constructors now accept Request as their argument.
  • Methods AppendPush and SetResponse accepts response Header and data as their arguments.
  • Method Err was removed because it was causing improper error handling. You need to check an error from Get, GetTyped or GetResponse with an addition check of a value Response.Header().Error, see ExampleErrorNo.

Connector interface

  • Operations Ping, Select, Insert, Replace, Delete, Update, Upsert, Call, Eval, Execute of a Connector return response data instead of an actual responses.
  • New interface Doer is added as a child-interface instead of a Do method.

Connect function

connection.Connect no longer return non-working connection objects. This function now does not attempt to reconnect and tries to establish a connection only once. Function might be canceled via context. Context accepted as first argument, and user may cancel it in process.

Now you need to pass Dialer as the second argument instead of URI. If you were using a non-SSL connection, you need to create NetDialer. For SSL-enabled connections, use OpenSSLDialer from the go-tlsdialer package.

Please note that the options for creating a connection are now stored in corresponding Dialer, not in Opts.

Connection schema

  • Removed Schema field from the Connection struct. Instead, new GetSchema(Doer) function was added to get the actual connection schema on demand.
  • OverrideSchema(*Schema) method replaced with the SetSchema(Schema).

Protocol types

  • iproto.Feature type used instead of ProtocolFeature.
  • iproto.IPROTO_FEATURE_ constants used instead of local ones.

Schema type

  • ResolveSpaceIndex function for SchemaResolver interface split into two: ResolveSpace and ResolveIndex. NamesUseSupported function added into the interface to get information if the usage of space and index names in requests is supported.
  • Schema structure no longer implements SchemaResolver interface.
  • Spaces and SpacesById fields of the Schema struct store spaces by value.
  • Fields and FieldsById fields of the Space struct store fields by value. Index and IndexById fields of the Space struct store indexes by value.
  • Fields field of the Index struct store IndexField by value.

datetime package

Now you need to use objects of the Datetime type instead of pointers to it. A new constructor MakeDatetime returns an object. NewDatetime has been removed. (MakeDatetime was later renamed back to NewDatetime in v3.)

decimal package

Now you need to use objects of the Decimal type instead of pointers to it. A new constructor MakeDecimal returns an object. NewDecimal has been removed. (MakeDecimal was later renamed back to NewDecimal in v3.)

multi package

The subpackage has been deleted. You could use pool instead.

pool package

  • The connection_pool subpackage has been renamed to pool.
  • The type PoolOpts has been renamed to Opts.
  • pool.Connect and pool.ConnectWithOpts now accept context as the first argument, which user may cancel in process. If it is canceled in progress, an error will be returned and all created connections will be closed.
  • pool.Connect and pool.ConnectWithOpts now accept []pool.Instance as the second argument instead of a list of addresses. Each instance is associated with a unique string name, Dialer and connection options which allows instances to be independently configured.
  • pool.Connect, pool.ConnectWithOpts and pool.Add add instances into the pool even it is unable to connect to it. The pool will try to connect to the instance later.
  • pool.Add now accepts context as the first argument, which user may cancel in process.
  • pool.Add now accepts pool.Instance as the second argument instead of an address, it allows to configure a new instance more flexible.
  • pool.GetPoolInfo has been renamed to pool.GetInfo. Return type has been changed to map[string]ConnectionInfo.
  • Operations Ping, Select, Insert, Replace, Delete, Update, Upsert, Call, Eval, Execute of a Pooler return response data instead of an actual responses.

crud package

  • crud operations Timeout option has crud.OptFloat64 type instead of crud.OptUint.
  • A slice of a custom type could be used as tuples for ReplaceManyRequest and InsertManyRequest, ReplaceObjectManyRequest.
  • A slice of a custom type could be used as objects for ReplaceObjectManyRequest and InsertObjectManyRequest.

test_helpers package

  • Renamed StrangerResponse to MockResponse.

  • MockDoer is now an interface instead of a struct. Use NewMockDoer(t) to create an instance, then chain AddResponseRaw(), AddResponseError(), AddResponse() to configure responses. The Requests field is now a method Requests() that returns recorded requests.

    Before:

    mock := test_helpers.NewMockDoer(t,
        test_helpers.NewMockResponse(t, []interface{}{"data"}),
        errors.New("some error"),
    )
    requests := mock.Requests
    

    After:

    mock := test_helpers.NewMockDoer(t).
        AddResponseRaw([]interface{}{"data"}).
        AddResponseError(errors.New("some error"))
    requests := mock.Requests()