Documentation
¶
Index ¶
Constants ¶
const ( TCPNetwork = "tcp" UnixNetwork = "unix" // DefaultConnectTimeout bounds binary connection establishment. DefaultConnectTimeout = time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaryConnector ¶
type BinaryConnector struct {
// contains filtered or unexported fields
}
BinaryConnector implements Connector interface for a connection that sends and receives data via IPROTO.
func NewBinaryConnector ¶
func NewBinaryConnector(conn tarantool.Connector) *BinaryConnector
NewBinaryConnector creates a new BinaryConnector object. The object will close the tarantool.Connector argument in Close() call.
func (*BinaryConnector) Close ¶
func (conn *BinaryConnector) Close() error
Close closes the tarantool.Connector created from.
func (*BinaryConnector) Eval ¶
func (conn *BinaryConnector) Eval(expr string, args []any, opts RequestOpts, ) ([]any, error)
Eval sends an eval request.
type ConnectOpts ¶
type ConnectOpts struct {
// Network is a characteristic of a connection like "type" ("tcp" and
// "unix" are used).
Network string
// Address of an instance.
Address string
// Username of the tarantool user.
Username string
// Password of the user.
Password string
// Ssl options for a connection.
Ssl SslOpts
// ConnectTimeout bounds binary connection establishment. Non-positive values
// select DefaultConnectTimeout. It does not limit subsequent requests.
ConnectTimeout time.Duration
}
ConnectOpts describes options for a connection to a tarantool instance.
type Connector ¶
Connector is an interface that wraps all method required for a connector.
func Connect ¶
func Connect(opts ConnectOpts) (Connector, error)
Connect connects to the tarantool instance according to options.
func ConnectContext ¶
func ConnectContext(ctx context.Context, opts ConnectOpts) (Connector, error)
ConnectContext connects according to options. ctx bounds connection setup, including protocol detection, authentication and binary protocol negotiation.
type EvalPlainTextOpts ¶
type Evaler ¶
type Evaler interface {
// Eval passes Lua expression for evaluation.
Eval(expr string, args []any, opts RequestOpts) ([]any, error)
}
Evaler is an interface that wraps Eval method.
type PlainTextEvalRes ¶
type PlainTextEvalRes struct {
DataEncBase64 string `yaml:"data_enc"`
}
type Protocol ¶
type Protocol int
Protocol defines a set of supported protocols for a connect.
func GetProtocol ¶
GetProtocol gets a protocol name from the reader greeting. See: https://github.com/tarantool/tarantool/blob/8dcefeb2bf5291487496d168cb81f5b6082a2af0/ test/unit/xrow.cc#L92-L123.
func ParseProtocol ¶
ParseProtocol parses a protocol name from a Tarantool greeting.
type RequestOpts ¶
type RequestOpts struct {
// PushCallback is called when a push message is received by the text protocol.
// The binary protocol ignores it because go-tarantool v3 does not expose pushes.
PushCallback func(any)
// ReadTimeout timeout for the operation.
ReadTimeout time.Duration
// ResData describes the typed result of the operation executed.
ResData any
}
RequestOpts describes the parameters of a request to be executed.
type SslOpts ¶
type SslOpts struct {
// KeyFile is a path to a private SSL key file.
KeyFile string
// CertFile is a path to an SSL certificate file.
CertFile string
// CaFile is a path to a trusted certificate authorities (CA) file.
CaFile string
// Ciphers is a colon-separated (:) list of SSL cipher suites the
// connection can use.
Ciphers string
// Password decrypts the private SSL key file.
Password string
// PasswordFile contains candidate passwords for the private SSL key file.
PasswordFile string
// Transport chooses whether the connection is a TLS one:
// dial.TransportSsl makes it one even with no other option set,
// dial.TransportPlain makes it a plain one and is an error with any
// other option set, and dial.TransportDefault makes it one if any other
// option is set.
Transport dial.Transport
}
SslOpts is a way to configure SSL connection.
type TextConnector ¶
type TextConnector struct {
// contains filtered or unexported fields
}
TextConnector implements Connector interface for a connection that sends and receives data as a plain text.
func NewTextConnector ¶
func NewTextConnector(conn net.Conn) *TextConnector
NewTextConnector creates a new TextConnector object. The object will close the net.Conn argument in Close() call.
func (*TextConnector) Close ¶
func (conn *TextConnector) Close() error
Close closes the net.Conn created from.
func (*TextConnector) Eval ¶
func (conn *TextConnector) Eval(expr string, args []any, opts RequestOpts, ) ([]any, error)
Eval sends an eval request.