settings

package
v2.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: BSD-2-Clause Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package settings is a collection of requests to set a connection session setting or get current session configuration.

+============================+=========================+=========+===========================+
|           Setting          |         Meaning         | Default |       Supported in        |
|                            |                         |         |     Tarantool versions    |
+============================+=========================+=========+===========================+
|   ErrorMarshalingEnabled   | Defines whether error   |  false  | Since 2.4.1 till 2.10.0,  |
|                            | objectshave a special   |         | replaced with IPROTO_ID   |
|                            | structure.              |         | feature flag.             |
+----------------------------+-------------------------+---------+---------------------------+
|      SQLDefaultEngine      | Defines default storage | "memtx" | Since 2.3.1.              |
|                            | engine for new SQL      |         |                           |
|                            | tables.                 |         |                           |
+----------------------------+-------------------------+---------+---------------------------+
|     SQLDeferForeignKeys    | Defines whether         |  false  | Since 2.3.1 till master   |
|                            | foreign-key checks can  |         | commit 14618c4 (possible  |
|                            |  wait till commit.      |         | 2.10.5 or 2.11.0)         |
+----------------------------+-------------------------+---------+---------------------------+
|     SQLFullColumnNames     | Defines whether full    |  false  | Since 2.3.1.              |
|                            | column names is         |         |                           |
|                            | displayed in SQL result |         |                           |
|                            | set metadata.           |         |                           |
+----------------------------+-------------------------+---------+---------------------------+
|      SQLFullMetadata       | Defines whether SQL     |  false  | Since 2.3.1.              |
|                            | result set metadata     |         |                           |
|                            | will have more than     |         |                           |
|                            | just name and type.     |         |                           |
+----------------------------+-------------------------+---------+---------------------------+
|       SQLParserDebug       | Defines whether to show |  false  | Since 2.3.1 (only if      |
|                            | parser steps for        |         | built with                |
|                            | following statements.   |         | -DCMAKE_BUILD_TYPE=Debug) |
+----------------------------+-------------------------+---------+---------------------------+
|    SQLRecursiveTriggers    | Defines whether a       |  true   | Since 2.3.1.              |
|                            | triggered statement can |         |                           |
|                            | activate a trigger.     |         |                           |
+----------------------------+-------------------------+---------+---------------------------+
| SQLReverseUnorderedSelects | Defines defines whether |  false  | Since 2.3.1.              |
|                            | result rows are usually |         |                           |
|                            | in reverse order if     |         |                           |
|                            | there is no ORDER BY    |         |                           |
|                            | clause.                 |         |                           |
+----------------------------+-------------------------+---------+---------------------------+
|       SQLSelectDebug       | Defines whether to show |  false  | Since 2.3.1 (only if      |
|                            | to show execution steps |         | built with                |
|                            | during SELECT.          |         | -DCMAKE_BUILD_TYPE=Debug) |
+----------------------------+-------------------------+---------+---------------------------+
|        SQLVDBEDebug        | Defines whether VDBE    |  false  | Since 2.3.1 (only if      |
|                            | debug mode is enabled.  |         | built with                |
|                            |                         |         | -DCMAKE_BUILD_TYPE=Debug) |
+----------------------------+-------------------------+---------+---------------------------+

Since: 1.10.0

See also:

Example (SqlFullColumnNames)
package main

import (
	"context"
	"fmt"
	"time"

	"github.com/tarantool/go-tarantool/v2"
	"github.com/tarantool/go-tarantool/v2/settings"
	"github.com/tarantool/go-tarantool/v2/test_helpers"
)

var exampleDialer = tarantool.NetDialer{
	Address:  "127.0.0.1",
	User:     "test",
	Password: "test",
}

var exampleOpts = tarantool.Opts{
	Timeout: 5 * time.Second,
}

func example_connect(dialer tarantool.Dialer, opts tarantool.Opts) *tarantool.Connection {
	ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
	defer cancel()
	conn, err := tarantool.Connect(ctx, dialer, opts)
	if err != nil {
		panic("Connection is not established: " + err.Error())
	}
	return conn
}

func main() {
	var resp tarantool.Response
	var err error
	var isLess bool

	conn := example_connect(exampleDialer, exampleOpts)
	defer conn.Close()

	// Tarantool supports session settings since version 2.3.1
	isLess, err = test_helpers.IsTarantoolVersionLess(2, 3, 1)
	if err != nil || isLess {
		return
	}

	// Create a space.
	req := tarantool.NewExecuteRequest("CREATE TABLE example(id INT PRIMARY KEY, x INT);")
	_, err = conn.Do(req).Get()
	if err != nil {
		fmt.Printf("error in create table: %v\n", err)
		return
	}

	// Insert some tuple into space.
	req = tarantool.NewExecuteRequest("INSERT INTO example VALUES (1, 1);")
	_, err = conn.Do(req).Get()
	if err != nil {
		fmt.Printf("error on insert: %v\n", err)
		return
	}

	// Enable showing full column names in SQL responses.
	_, err = conn.Do(settings.NewSQLFullColumnNamesSetRequest(true)).Get()
	if err != nil {
		fmt.Printf("error on setting setup: %v\n", err)
		return
	}

	// Get some data with SQL query.
	req = tarantool.NewExecuteRequest("SELECT x FROM example WHERE id = 1;")
	resp, err = conn.Do(req).GetResponse()
	if err != nil {
		fmt.Printf("error on select: %v\n", err)
		return
	}

	exResp, ok := resp.(*tarantool.ExecuteResponse)
	if !ok {
		fmt.Printf("wrong response type")
		return
	}

	metaData, err := exResp.MetaData()
	if err != nil {
		fmt.Printf("error on getting MetaData: %v\n", err)
		return
	}
	// Show response metadata.
	fmt.Printf("full column name: %v\n", metaData[0].FieldName)

	// Disable showing full column names in SQL responses.
	_, err = conn.Do(settings.NewSQLFullColumnNamesSetRequest(false)).Get()
	if err != nil {
		fmt.Printf("error on setting setup: %v\n", err)
		return
	}

	// Get some data with SQL query.
	resp, err = conn.Do(req).GetResponse()
	if err != nil {
		fmt.Printf("error on select: %v\n", err)
		return
	}
	exResp, ok = resp.(*tarantool.ExecuteResponse)
	if !ok {
		fmt.Printf("wrong response type")
		return
	}
	metaData, err = exResp.MetaData()
	if err != nil {
		fmt.Printf("error on getting MetaData: %v\n", err)
		return
	}
	// Show response metadata.
	fmt.Printf("short column name: %v\n", metaData[0].FieldName)
}

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetRequest

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

GetRequest helps to get session settings.

func NewErrorMarshalingEnabledGetRequest

func NewErrorMarshalingEnabledGetRequest() *GetRequest

NewErrorMarshalingEnabledGetRequest creates a request to get current session ErrorMarshalingEnabled setting in tuple format.

func NewSQLDefaultEngineGetRequest

func NewSQLDefaultEngineGetRequest() *GetRequest

NewSQLDefaultEngineGetRequest creates a request to get current session SQLDefaultEngine setting in tuple format.

func NewSQLDeferForeignKeysGetRequest

func NewSQLDeferForeignKeysGetRequest() *GetRequest

NewSQLDeferForeignKeysGetRequest creates a request to get current session SQLDeferForeignKeys setting in tuple format.

func NewSQLFullColumnNamesGetRequest

func NewSQLFullColumnNamesGetRequest() *GetRequest

NewSQLFullColumnNamesGetRequest creates a request to get current session SQLFullColumnNames setting in tuple format.

func NewSQLFullMetadataGetRequest

func NewSQLFullMetadataGetRequest() *GetRequest

NewSQLFullMetadataGetRequest creates a request to get current session SQLFullMetadata setting in tuple format.

func NewSQLParserDebugGetRequest

func NewSQLParserDebugGetRequest() *GetRequest

NewSQLParserDebugGetRequest creates a request to get current session SQLParserDebug setting in tuple format.

func NewSQLRecursiveTriggersGetRequest

func NewSQLRecursiveTriggersGetRequest() *GetRequest

NewSQLRecursiveTriggersGetRequest creates a request to get current session SQLRecursiveTriggers setting in tuple format.

func NewSQLReverseUnorderedSelectsGetRequest

func NewSQLReverseUnorderedSelectsGetRequest() *GetRequest

NewSQLReverseUnorderedSelectsGetRequest creates a request to get current session SQLReverseUnorderedSelects setting in tuple format.

func NewSQLSelectDebugGetRequest

func NewSQLSelectDebugGetRequest() *GetRequest

NewSQLSelectDebugGetRequest creates a request to get current session SQLSelectDebug setting in tuple format.

func NewSQLVDBEDebugGetRequest

func NewSQLVDBEDebugGetRequest() *GetRequest

NewSQLVDBEDebugGetRequest creates a request to get current session SQLVDBEDebug setting in tuple format.

func NewSessionSettingsGetRequest

func NewSessionSettingsGetRequest() *GetRequest

NewSessionSettingsGetRequest creates a request to get all current session settings in tuple format.

func (*GetRequest) Async

func (req *GetRequest) Async() bool

Async returns is get session settings request expects a response.

func (*GetRequest) Body

func (req *GetRequest) Body(res tarantool.SchemaResolver, enc *msgpack.Encoder) error

Body fills an encoder with get session settings request body.

func (*GetRequest) Context

func (req *GetRequest) Context(ctx context.Context) *GetRequest

Context sets a passed context to get session settings request.

func (*GetRequest) Ctx

func (req *GetRequest) Ctx() context.Context

Ctx returns a context of get session settings request.

func (*GetRequest) Response

func (req *GetRequest) Response(header tarantool.Header,
	body io.Reader) (tarantool.Response, error)

Response creates a response for the GetRequest.

func (*GetRequest) Type

func (req *GetRequest) Type() iproto.Type

Type returns IPROTO type for get session settings request.

type SetRequest

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

SetRequest helps to set session settings.

func NewErrorMarshalingEnabledSetRequest

func NewErrorMarshalingEnabledSetRequest(value bool) *SetRequest

NewErrorMarshalingEnabledSetRequest creates a request to update current session ErrorMarshalingEnabled setting.

func NewSQLDefaultEngineSetRequest

func NewSQLDefaultEngineSetRequest(value string) *SetRequest

NewSQLDefaultEngineSetRequest creates a request to update current session SQLDefaultEngine setting.

func NewSQLDeferForeignKeysSetRequest

func NewSQLDeferForeignKeysSetRequest(value bool) *SetRequest

NewSQLDeferForeignKeysSetRequest creates a request to update current session SQLDeferForeignKeys setting.

func NewSQLFullColumnNamesSetRequest

func NewSQLFullColumnNamesSetRequest(value bool) *SetRequest

NewSQLFullColumnNamesSetRequest creates a request to update current session SQLFullColumnNames setting.

func NewSQLFullMetadataSetRequest

func NewSQLFullMetadataSetRequest(value bool) *SetRequest

NewSQLFullMetadataSetRequest creates a request to update current session SQLFullMetadata setting.

func NewSQLParserDebugSetRequest

func NewSQLParserDebugSetRequest(value bool) *SetRequest

NewSQLParserDebugSetRequest creates a request to update current session SQLParserDebug setting.

func NewSQLRecursiveTriggersSetRequest

func NewSQLRecursiveTriggersSetRequest(value bool) *SetRequest

NewSQLRecursiveTriggersSetRequest creates a request to update current session SQLRecursiveTriggers setting.

func NewSQLReverseUnorderedSelectsSetRequest

func NewSQLReverseUnorderedSelectsSetRequest(value bool) *SetRequest

NewSQLReverseUnorderedSelectsSetRequest creates a request to update current session SQLReverseUnorderedSelects setting.

func NewSQLSelectDebugSetRequest

func NewSQLSelectDebugSetRequest(value bool) *SetRequest

NewSQLSelectDebugSetRequest creates a request to update current session SQLSelectDebug setting.

func NewSQLVDBEDebugSetRequest

func NewSQLVDBEDebugSetRequest(value bool) *SetRequest

NewSQLVDBEDebugSetRequest creates a request to update current session SQLVDBEDebug setting.

func (*SetRequest) Async

func (req *SetRequest) Async() bool

Async returns is set session settings request expects a response.

func (*SetRequest) Body

func (req *SetRequest) Body(res tarantool.SchemaResolver, enc *msgpack.Encoder) error

Body fills an encoder with set session settings request body.

func (*SetRequest) Context

func (req *SetRequest) Context(ctx context.Context) *SetRequest

Context sets a passed context to set session settings request.

func (*SetRequest) Ctx

func (req *SetRequest) Ctx() context.Context

Ctx returns a context of set session settings request.

func (*SetRequest) Response

func (req *SetRequest) Response(header tarantool.Header,
	body io.Reader) (tarantool.Response, error)

Response creates a response for the SetRequest.

func (*SetRequest) Type

func (req *SetRequest) Type() iproto.Type

Type returns IPROTO type for set session settings request.

Jump to

Keyboard shortcuts

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