Migration guide
June 8, 2026 · View on GitHub
- Migration from v2.x.x to v3.x.x
- Migration from v1.x.x to v2.x.x
Migration from v2.x.x to v3.x.x
Major changes
- Required Go version is
1.24now. - Import path changed from
github.com/tarantool/go-tarantool/v2togithub.com/tarantool/go-tarantool/v3. Futureis an interface now (was a concrete struct). All code that depends on the concrete*Futuretype must be updated to use theFutureinterface.- All request types use value receivers and constructors return values instead of pointers. Builder methods return modified copies instead of mutating in place.
Responseinterface has a newRelease()method. Any custom implementations must be updated.- Replaced custom
Loggerinterface with*slog.Loggerfrom the standard library. - Removed deprecated
ConnectionandConnectormethods. UseDo()with request types instead. - Removed deprecated
poolmethods. UseDo()with request types instead. - Removed
box.session.push()support:Future.AppendPush()andFuture.GetIterator()methods,ResponseIteratorandTimeoutResponseIteratortypes,PushResponsetype. - Renamed value constructors from
Make*toNew*for naming consistency across the connector. Pool.Close()andPool.CloseGraceful()return a singleerrorinstead 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()andConnection.Do()now returnFuture(interface) instead of*Future.Stream.Do()returnsFutureinstead of*Future.Future.Release()is a new method that frees resources allocated for theFutureobject. Call it when the future is no longer needed to allow buffer reuse.Future.donereplaced withFuture.cond(sync.Cond) +Future.finishedbool internally.Future.SetResponse()andFuture.SetError()are unexported now (useNewFutureWithErr/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 frominterface{}toany.
New factory functions replace direct construction:
| Function | Description |
|---|---|
NewFutureWithErr(req Request, err error) Future | Creates 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:
| Before | After |
|---|---|
NewPingRequest() *PingRequest | NewPingRequest() PingRequest |
NewSelectRequest(space) *SelectRequest | NewSelectRequest(space) SelectRequest |
NewInsertRequest(space) *InsertRequest | NewInsertRequest(space) InsertRequest |
NewReplaceRequest(space) *ReplaceRequest | NewReplaceRequest(space) ReplaceRequest |
NewDeleteRequest(space) *DeleteRequest | NewDeleteRequest(space) DeleteRequest |
NewUpdateRequest(space) *UpdateRequest | NewUpdateRequest(space) UpdateRequest |
NewUpsertRequest(space) *UpsertRequest | NewUpsertRequest(space) UpsertRequest |
NewCallRequest(func) *CallRequest | NewCallRequest(func) CallRequest |
NewEvalRequest(expr) *EvalRequest | NewEvalRequest(expr) EvalRequest |
NewExecuteRequest(expr) *ExecuteRequest | NewExecuteRequest(expr) ExecuteRequest |
NewWatchOnceRequest(key) *WatchOnceRequest | NewWatchOnceRequest(key) WatchOnceRequest |
NewPrepareRequest(expr) *PrepareRequest | NewPrepareRequest(expr) PrepareRequest |
NewUnprepareRequest(stmt) *UnprepareRequest | NewUnprepareRequest(stmt) UnprepareRequest |
NewExecutePreparedRequest(stmt) *ExecutePreparedRequest | NewExecutePreparedRequest(stmt) ExecutePreparedRequest |
NewBeginRequest() *BeginRequest | NewBeginRequest() BeginRequest |
NewCommitRequest() *CommitRequest | NewCommitRequest() CommitRequest |
NewRollbackRequest() *RollbackRequest | NewRollbackRequest() RollbackRequest |
NewBroadcastRequest(key) *BroadcastRequest | NewBroadcastRequest(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 theResponseinterface. Any custom implementations must be updated. CallRelease()to free resources allocated for a response (buffers, etc.).SelectResponse.Release(),ExecuteResponse.Release(),PrepareResponse.Release()— new methods that return response buffers to internalsync.Poolfor reuse.SelectResponse.Pos(),ExecuteResponse.MetaData(),ExecuteResponse.SQLInfo()— now properly return errors from implicitDecode()calls (previously errors were silently discarded).Response.Decode()return type changed from[]interface{}to[]any.Response.DecodeTyped()parameter type changed frominterface{}toany.- Removed
PushResponsetype. - Removed
ResponseIteratorandTimeoutResponseIteratorinterfaces.
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:
| Removed | Replacement |
|---|---|
Logger interface | *slog.Logger in Opts.Logger |
ConnLogKind type | String constants (e.g., LogMsgReconnectFailed) |
LogReconnectFailed | LogMsgReconnectFailed |
LogLastReconnectFailed | LogMsgLastReconnectFailed |
LogUnexpectedResultId | LogMsgUnexpectedRequestId |
LogWatchEventReadFailed | LogMsgWatchEventReadFailed |
LogAppendPushFailed | LogMsgPushUnsupported |
LogBoxSessionPushUnsupported | LogMsgPushUnsupported |
defaultLogger type | Discarded 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
RLimitActionstype renamed toRLimitAction(typo fix).Opts.Handlefield type changed frominterface{}toany.BoxError.Fieldsfield type changed frommap[string]interface{}tomap[string]any.WatchEvent.Valuefield type changed frominterface{}toany.SchemaResolver.ResolveSpace()parameter changed frominterface{}toany.SchemaResolver.ResolveIndex()parameter changed frominterface{}toany.EncodeSpace()parameter changed frominterface{}toany.KeyValueBind.Valuefield type changed frominterface{}toany.- New
OptionalBoxErrortype for optionalBoxErrorvalues (compatible with thego-optionlibrary). - New
LogKeyAttempt,LogKeyMaxAttempts,LogKeyError,LogKeyRequestId,LogKeyAddressstring constants for structured log attribute keys.
pool package
ConnectionPooltype renamed toPool.ConnectionHandlerinterface renamed toHandler.ConnectionInfotype renamed toInfo, fieldConnRolerenamed toRole.ConnectionPoolOptstype renamed toOpts.Pool.GetInfo()renamed toPool.Info().Pool.DoInstance()renamed toPool.DoOn().pool.Connect()renamed topool.New(),pool.ConnectWithOpts()renamed topool.NewWithOpts().
Enum constants renamed to use prefix:
| Before | After |
|---|---|
ANY | ModeAny |
RW | ModeRW |
RO | ModeRO |
PreferRW | ModePreferRW |
PreferRO | ModePreferRO |
UnknownRole | RoleUnknown |
MasterRole | RoleMaster |
ReplicaRole | RoleReplica |
-
Pool.Close()andPool.CloseGraceful()now return a singleerrorinstead of[]error. Multiple errors are combined usingerrors.Join(). -
Poolerinterface updated:Close() error,CloseGraceful() error,Do(req Request, mode Mode) Future(was*tarantool.Future). -
pool.New(),pool.NewWithOpts()andPool.Add()now return an error iftarantool.Opts.Reconnect,tarantool.Opts.MaxReconnectsortarantool.Opts.Notifyoptions are set for an instance connection. These options create conflicts with the pool's own reconnection logic: the pool reconnects viapool.Opts.CheckTimeout, so an internalReconnectcreates a race with the pool;MaxReconnectspermanently closes a Connection while the pool would create a new one;Notifyevents from an individual connection are misleading in a pool context (e.g.,Disconnecteddoes not mean the endpoint is unavailable). Usepool.Handlerto track endpoint availability. All validation errors are combined usingerrors.Joinand can be checked witherrors.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.ConnectionPoolrenamed topool.Pool. -
pool.ConnectionHandlerrenamed topool.Handler. -
pool.ConnectionInforenamed topool.Info, fieldConnRolerenamed toRole. -
pool.Pool.GetInfo()renamed topool.Pool.Info(). -
pool.Pool.DoInstance()renamed topool.Pool.DoOn(). -
pool.Connect()renamed topool.New(),pool.ConnectWithOpts()renamed topool.NewWithOpts(). -
poolenum constants renamed to use prefix:ANY→ModeAny,RW→ModeRW,RO→ModeRO,PreferRW→ModePreferRW,PreferRO→ModePreferRO,UnknownRole→RoleUnknown,MasterRole→RoleMaster,ReplicaRole→RoleReplica. -
Error types redesigned around Go's
errors.Is/errors.As(#469):-
tarantool.Error(server-side error wrapper) renamed totarantool.ServerError. -
ClientError.Codeis now typed asiproto.Error(same numeric values as the olduint32constants), matchingServerError.Code. -
ClientError.Temporary()removed. Usetarantool.IsRetryableError(err)orerrors.Is(err, tarantool.ErrRetryable). -
The seven legacy
uint32constants are now package-levelerrorsentinels matched viaerrors.Is. Numeric forms remain available astarantool.Code*constants:Old ( uint32constant)New sentinel Numeric ( iproto.Error)ErrConnectionNotReadyErrConnectionNotReadyCodeConnectionNotReadyErrConnectionClosedErrConnectionClosedCodeConnectionClosedErrProtocolErrorErrProtocolErrorCodeProtocolErrorErrTimeoutedErrTimeoutedCodeTimeoutedErrRateLimitedErrRateLimitedCodeRateLimitedErrConnectionShutdownErrConnectionShutdownCodeConnectionShutdownErrIoErrorErrIoErrorCodeIoError -
ClientErrorgained aCause errorfield; I/O failures wrap their underlyingnet-layer error and can be inspected witherrors.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 theFutureobject created by aConnectionobject. -
Removed deprecated
NewCall16RequestandNewCall17Requestconstructors. UseNewCallRequestinstead.NewCallRequestusesIPROTO_CALL, which has been the default since Tarantool 1.7.2. -
New
Tinterface added to allow test helpers to be used in example functions, benchmarks, and custom test frameworks.*testing.Tsatisfies 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_helpersthat previously accepted*testing.Tnow accept theTinterface instead, making them usable in broader contexts like example functions and custom test runners. -
MockDoeris now an interface instead of a struct. UseNewMockDoer(t)to create an instance, then chainAddResponseRaw(),AddResponseError(),AddResponse()to configure responses. TheRequestsfield is now a methodRequests()that returns recorded requests.Before:
mock := test_helpers.NewMockDoer(t, test_helpers.NewMockResponse(t, []any{"data"}), errors.New("some error"), ) requests := mock.RequestsAfter:
mock := test_helpers.NewMockDoer(t). AddResponseRaw([]any{"data"}). AddResponseError(errors.New("some error")) requests := mock.Requests() -
test_helpers.CheckPoolStatusesandtest_helpers.ProcessListenOnInstancenow accept typed arguments (CheckStatusesArgsandListenOnInstanceArgsrespectively) instead ofinterface{}. -
New
test_helpers.ExecuteOnAllfunction to execute operations on all instances in parallel with context support. -
New
test_helpers.DumpLogsIfFailed(t, inst)helper that prints captured tarantool logs viat.Logfwhen the test failed. -
New
(*TarantoolInstance).LogTail()method that returns the last 50 lines of captured tarantool stdout/stderr. -
Removed
test_helpers.Retryfunction. Useassert.Eventuallyfrom testify instead.
Migration from v1.x.x to v2.x.x
Major changes
- The
go_tarantool_call_17build tag is no longer needed, since by default theCallRequestisCall17Request. - The
go_tarantool_msgpack_v5build tag is no longer needed, since only themsgpack/v5library is used. - The
go_tarantool_ssl_disablebuild tag is no longer needed, since the connector is no longer depends onOpenSSLby default. You could use the external library go-tlsdialer to create a connection with thessltransport. - Required Go version is
1.20now. - The
Connectfunction became more flexible. It now allows to create a connection with cancellation and a customDialerimplementation. - It is required to use
Requestimplementation types with theConnection.Domethod instead ofConnection.<Request>methods. - The
connection_poolpackage renamed topool.
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.
PushCodeconstant is removed. To check whether the current response is a push response, useIsPush()method of the response iterator instead.ErrorNoconstant is added to indicate that no error has occurred while getting the response. It should be used instead of the removedOkCode. SeeExampleErrorNo.
Request interface
- The method
Code() uint32replaced by theType() iproto.Type. Responsemethod added to theRequestinterface.
Request changes
- Requests
Update,UpdateAsync,UpdateTyped,Upsert,UpsertAsyncno longer acceptopsargument (operations) as aninterface{}.*Operationsneeds to be passed instead. Opstruct for update operations made private.- Removed
OpSplicestruct. Operations.Splicemethod now accepts 5 arguments instead of 3.UpdateRequestandUpsertRequeststructs no longer acceptinterface{}for anopsfield.*Operationsneeds to be used instead.
Response interface
Responseis now an interface.- Response header stored in a new
Headerstruct. It could be accessed viaHeader()method.
Response changes
ResponseIteratorinterface now hasIsPush()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
Responseinterface.SelectResponse,PrepareResponse,ExecuteResponse,PushResponseare 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
Getnow returns response data instead of the actual response. - New method
GetResponseadded to get an actual response. Futureconstructors now acceptRequestas their argument.- Methods
AppendPushandSetResponseaccepts responseHeaderand data as their arguments. - Method
Errwas removed because it was causing improper error handling. You need to check an error fromGet,GetTypedorGetResponsewith an addition check of a valueResponse.Header().Error, seeExampleErrorNo.
Connector interface
- Operations
Ping,Select,Insert,Replace,Delete,Update,Upsert,Call,Eval,Executeof aConnectorreturn response data instead of an actual responses. - New interface
Doeris added as a child-interface instead of aDomethod.
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
Schemafield from theConnectionstruct. Instead, newGetSchema(Doer)function was added to get the actual connection schema on demand. OverrideSchema(*Schema)method replaced with theSetSchema(Schema).
Protocol types
iproto.Featuretype used instead ofProtocolFeature.iproto.IPROTO_FEATURE_constants used instead of local ones.
Schema type
ResolveSpaceIndexfunction forSchemaResolverinterface split into two:ResolveSpaceandResolveIndex.NamesUseSupportedfunction added into the interface to get information if the usage of space and index names in requests is supported.Schemastructure no longer implementsSchemaResolverinterface.SpacesandSpacesByIdfields of theSchemastruct store spaces by value.FieldsandFieldsByIdfields of theSpacestruct store fields by value.IndexandIndexByIdfields of theSpacestruct store indexes by value.Fieldsfield of theIndexstruct storeIndexFieldby 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_poolsubpackage has been renamed topool. - The type
PoolOptshas been renamed toOpts. pool.Connectandpool.ConnectWithOptsnow 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.Connectandpool.ConnectWithOptsnow accept[]pool.Instanceas the second argument instead of a list of addresses. Each instance is associated with a unique string name,Dialerand connection options which allows instances to be independently configured.pool.Connect,pool.ConnectWithOptsandpool.Addadd instances into the pool even it is unable to connect to it. The pool will try to connect to the instance later.pool.Addnow accepts context as the first argument, which user may cancel in process.pool.Addnow acceptspool.Instanceas the second argument instead of an address, it allows to configure a new instance more flexible.pool.GetPoolInfohas been renamed topool.GetInfo. Return type has been changed tomap[string]ConnectionInfo.- Operations
Ping,Select,Insert,Replace,Delete,Update,Upsert,Call,Eval,Executeof aPoolerreturn response data instead of an actual responses.
crud package
crudoperationsTimeoutoption hascrud.OptFloat64type instead ofcrud.OptUint.- A slice of a custom type could be used as tuples for
ReplaceManyRequestandInsertManyRequest,ReplaceObjectManyRequest. - A slice of a custom type could be used as objects for
ReplaceObjectManyRequestandInsertObjectManyRequest.
test_helpers package
-
Renamed
StrangerResponsetoMockResponse. -
MockDoeris now an interface instead of a struct. UseNewMockDoer(t)to create an instance, then chainAddResponseRaw(),AddResponseError(),AddResponse()to configure responses. TheRequestsfield is now a methodRequests()that returns recorded requests.Before:
mock := test_helpers.NewMockDoer(t, test_helpers.NewMockResponse(t, []interface{}{"data"}), errors.New("some error"), ) requests := mock.RequestsAfter:
mock := test_helpers.NewMockDoer(t). AddResponseRaw([]interface{}{"data"}). AddResponseError(errors.New("some error")) requests := mock.Requests()