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:
- Session settings: https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_space/_session_settings/
Example (SqlFullColumnNames) ¶
package main import ( "fmt" "github.com/GruffGemini/go-tarantool/v2" "github.com/GruffGemini/go-tarantool/v2/settings" "github.com/GruffGemini/go-tarantool/v2/test_helpers" ) func example_connect(opts tarantool.Opts) *tarantool.Connection { conn, err := tarantool.Connect(server, 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(opts) 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;") _, err = conn.Do(req).Get() if err != nil { fmt.Printf("error on select: %v\n", err) return } // Show response metadata. fmt.Printf("full column name: %v\n", resp.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. _, err = conn.Do(req).Get() if err != nil { fmt.Printf("error on select: %v\n", err) return } // Show response metadata. fmt.Printf("short column name: %v\n", resp.MetaData[0].FieldName) }
Output:
Index ¶
- type GetRequest
- func NewErrorMarshalingEnabledGetRequest() *GetRequest
- func NewSQLDefaultEngineGetRequest() *GetRequest
- func NewSQLDeferForeignKeysGetRequest() *GetRequest
- func NewSQLFullColumnNamesGetRequest() *GetRequest
- func NewSQLFullMetadataGetRequest() *GetRequest
- func NewSQLParserDebugGetRequest() *GetRequest
- func NewSQLRecursiveTriggersGetRequest() *GetRequest
- func NewSQLReverseUnorderedSelectsGetRequest() *GetRequest
- func NewSQLSelectDebugGetRequest() *GetRequest
- func NewSQLVDBEDebugGetRequest() *GetRequest
- func NewSessionSettingsGetRequest() *GetRequest
- type SetRequest
- func NewErrorMarshalingEnabledSetRequest(value bool) *SetRequest
- func NewSQLDefaultEngineSetRequest(value string) *SetRequest
- func NewSQLDeferForeignKeysSetRequest(value bool) *SetRequest
- func NewSQLFullColumnNamesSetRequest(value bool) *SetRequest
- func NewSQLFullMetadataSetRequest(value bool) *SetRequest
- func NewSQLParserDebugSetRequest(value bool) *SetRequest
- func NewSQLRecursiveTriggersSetRequest(value bool) *SetRequest
- func NewSQLReverseUnorderedSelectsSetRequest(value bool) *SetRequest
- func NewSQLSelectDebugSetRequest(value bool) *SetRequest
- func NewSQLVDBEDebugSetRequest(value bool) *SetRequest
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) 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) Type ¶
func (req *SetRequest) Type() iproto.Type
Type returns IPROTO type for set session settings request.