box

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

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

Box is a helper that wraps box.* requests. It holds a connection to the Tarantool instance via the Doer interface.

func MustNew

func MustNew(conn tarantool.Doer) *Box

MustNew returns a new instance of the box structure, which implements the Box interface. It panics if conn == nil.

func New

func New(conn tarantool.Doer) (*Box, error)

New returns a new instance of the box structure, which implements the Box interface.

func (*Box) Info

func (b *Box) Info() (Info, error)

Info retrieves the current information of the Tarantool instance. It calls the "box.info" function and parses the result into the Info structure.

Example
package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"github.com/tarantool/go-tarantool/v3"
	"github.com/tarantool/go-tarantool/v3/box"
)

func main() {
	dialer := tarantool.NetDialer{
		Address:  "127.0.0.1:3013",
		User:     "test",
		Password: "test",
	}
	ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
	client, err := tarantool.Connect(ctx, dialer, tarantool.Opts{})
	cancel()
	if err != nil {
		log.Fatalf("Failed to connect: %s", err)
	}

	// You can use Info Request type.

	fut := client.Do(box.NewInfoRequest())

	resp := &box.InfoResponse{}

	err = fut.GetTyped(resp)
	if err != nil {
		log.Fatalf("Failed get box info: %s", err)
	}

	// Or use simple Box implementation.

	b := box.MustNew(client)

	info, err := b.Info()
	if err != nil {
		log.Fatalf("Failed get box info: %s", err)
	}

	if info.UUID != resp.Info.UUID {
		log.Fatalf("Box info uuids are not equal")
	}

	fmt.Printf("Box info uuids are equal\n")
	fmt.Printf("Current box ro: %+v", resp.Info.RO)
}
Output:
Box info uuids are equal
Current box ro: false

func (*Box) Schema

func (b *Box) Schema() *Schema

Schema returns a new Schema instance, providing access to schema-related operations. It uses the connection from the Box instance to communicate with Tarantool.

func (*Box) Session

func (b *Box) Session() *Session

Session method returns a new Session object associated with the Box instance.

type Downstream

type Downstream struct {
	// Status is replication status of the connection with the instance.
	Status string `msgpack:"status"`
	// Idle is the time (in seconds) since the last event was received.
	Idle float64 `msgpack:"idle"`
	// VClock contains the vector clock, which is a table of ‘id, lsn’ pairs.
	VClock map[int]uint64 `msgpack:"vclock"`
	// Lag is the time difference between the local time of instance n,
	// recorded when the event was received, and the local time at another master
	// recorded when the event was written to the write-ahead log on that master.
	Lag float64 `msgpack:"lag"`
	// Message contains an error message in case of a degraded state; otherwise, it is nil.
	Message string `msgpack:"message,omitempty"`
	// SystemMessage contains an error message in case of a degraded state; otherwise, it is nil.
	SystemMessage string `msgpack:"system_message,omitempty"`
}

Downstream information.

type Info

type Info struct {
	// The Version of the Tarantool instance.
	Version string `msgpack:"version"`
	// The node ID (nullable).
	ID *int `msgpack:"id"`
	// Read-only (RO) status of the instance.
	RO bool `msgpack:"ro"`
	// UUID - Unique identifier of the instance.
	UUID string `msgpack:"uuid"`
	// Process ID of the instance.
	PID int `msgpack:"pid"`
	// Status - Current status of the instance (e.g., running, unconfigured).
	Status string `msgpack:"status"`
	// LSN - Log sequence number of the instance.
	LSN uint64 `msgpack:"lsn"`
	// Replication - replication status.
	Replication map[int]Replication `msgpack:"replication,omitempty"`
}

Info represents detailed information about the Tarantool instance. It includes version, node ID, read-only status, process ID, cluster information, and more.

type InfoRequest

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

InfoRequest represents a request to retrieve information about the Tarantool instance. It implements the tarantool.Request interface.

func NewInfoRequest

func NewInfoRequest() InfoRequest

NewInfoRequest returns a new empty info request.

func (InfoRequest) Async

func (req InfoRequest) Async() bool

Async returns whether the request expects a response.

func (InfoRequest) Body

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

Body fills an encoder with the request body.

func (InfoRequest) Context

func (req InfoRequest) Context(ctx context.Context) InfoRequest

Context sets a passed context to the request.

func (InfoRequest) Ctx

func (req InfoRequest) Ctx() context.Context

Ctx returns a context of the request.

func (InfoRequest) Response

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

Response creates a response for the request.

func (InfoRequest) Type

func (req InfoRequest) Type() iproto.Type

Type returns IPROTO type for the request.

type InfoResponse

type InfoResponse struct {
	Info Info
}

InfoResponse represents the response structure that holds the information of the Tarantool instance. It contains a single field: Info, which holds the instance details (version, UUID, PID, etc.).

func (*InfoResponse) DecodeMsgpack

func (ir *InfoResponse) DecodeMsgpack(d *msgpack.Decoder) error

type Permission

type Permission string

Permission is a struct based on permission tarantool object https://www.tarantool.io/en/doc/latest/admin/access_control/#permissions

const (
	// PermissionRead allows reading data of the specified object.
	// For example, this permission can be used to allow a user
	// to select data from the specified space.
	PermissionRead Permission = "read"
	// PermissionWrite allows updating data of the specified object.
	// For example, this permission can be used to allow
	// a user to modify data in the specified space.
	PermissionWrite Permission = "write"
	// PermissionCreate allows creating objects of the specified type.
	// For example, this permission can be used to allow a user to create new spaces.
	// Note that this permission requires read and write access to certain system spaces.
	PermissionCreate Permission = "create"
	// PermissionAlter allows altering objects of the specified type.
	// Note that this permission requires read and write access to certain system spaces.
	PermissionAlter Permission = "alter"
	// PermissionDrop allows dropping objects of the specified type.
	// Note that this permission requires read and write access to certain system spaces.
	PermissionDrop Permission = "drop"
	// PermissionExecute for role,
	// allows using the specified role. For other object types, allows calling a function.
	// Can be used only for role, universe, function, lua_eval, lua_call, sql.
	PermissionExecute Permission = "execute"
	// PermissionSession allows a user to connect to an instance over IPROTO.
	PermissionSession Permission = "session"
	// PermissionUsage allows a user to use their privileges on database objects
	// (for example, read, write, and alter spaces).
	PermissionUsage Permission = "usage"
)

type Privilege

type Privilege struct {
	// Permissions is a list of privileges that apply to the privileges object type.
	Permissions []Permission
	// Type - one of privilege object types (it might be space,function, etc.).
	Type PrivilegeType
	// Name - can be the name of a function or space,
	// and can also be empty in case of universe access
	Name string
}

Privilege is a structure that is used to create new rights, as well as obtain information for rights.

type PrivilegeType

type PrivilegeType string

PrivilegeType is a struct based on privilege object types list https://www.tarantool.io/en/doc/latest/admin/access_control/#all-object-types-and-permissions

const (
	// PrivilegeUniverse - privilege type based on universe.
	// A database (box.schema) that contains database objects, including spaces,
	// indexes, users, roles, sequences, and functions.
	// Granting privileges to universe gives a user access to any object in the database.
	PrivilegeUniverse PrivilegeType = "universe"
	// PrivilegeTypeUser - privilege type based on user.
	// A user identifies a person or program that interacts with a Tarantool instance.
	PrivilegeTypeUser PrivilegeType = "user"
	// PrivilegeRole - privilege type based on role.
	// A role is a container for privileges that can be granted to users.
	// Roles can also be assigned to other roles, creating a role hierarchy.
	PrivilegeRole PrivilegeType = "role"
	// PrivilegeSpace - privilege type based on space.
	// Tarantool stores tuples in containers called spaces.
	PrivilegeSpace PrivilegeType = "space"
	// PrivilegeFunction - privilege type based on functions.
	// This allows access control based on function access.
	PrivilegeFunction PrivilegeType = "function"
	// PrivilegeSequence - privilege type based on sequences.
	// A sequence is a generator of ordered integer values.
	PrivilegeSequence PrivilegeType = "sequence"
	// PrivilegeLuaEval - privilege type based on executing arbitrary Lua code.
	PrivilegeLuaEval PrivilegeType = "lua_eval"
	// PrivilegeLuaCall - privilege type based on
	// calling any global user-defined Lua function.
	PrivilegeLuaCall PrivilegeType = "lua_call"
	// PrivilegeSQL - privilege type based on
	// executing an arbitrary SQL expression.
	PrivilegeSQL PrivilegeType = "sql"
)

type Replication

type Replication struct {
	// ID is a short numeric identifier of instance n within the replica set.
	ID int `msgpack:"id"`
	// UUID - Unique identifier of the instance.
	UUID string `msgpack:"uuid"`
	// LSN - Log sequence number of the instance.
	LSN uint64 `msgpack:"lsn"`
	// Upstream - information about upstream.
	Upstream Upstream `msgpack:"upstream,omitempty"`
	// Downstream - information about downstream.
	Downstream Downstream `msgpack:"downstream,omitempty"`
}

Replication section of box.info() is a table with statistics for all instances in the replica set that the current instance belongs to.

type Schema

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

Schema represents the schema-related operations in Tarantool. It holds a connection to interact with the Tarantool instance.

func (*Schema) User

func (s *Schema) User() *SchemaUser

User returns a new SchemaUser instance, allowing schema-related user operations.

type SchemaUser

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

SchemaUser provides methods to interact with schema-related user operations in Tarantool.

func (*SchemaUser) Create

func (u *SchemaUser) Create(ctx context.Context, username string, options UserCreateOptions) error

Create creates a new user in Tarantool with the given username and options.

Example
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/tarantool/go-tarantool/v3"
	"github.com/tarantool/go-tarantool/v3/box"
)

func main() {
	// Connect to Tarantool.
	dialer := tarantool.NetDialer{
		Address:  "127.0.0.1:3013",
		User:     "test",
		Password: "test",
	}
	ctx := context.Background()

	client, err := tarantool.Connect(ctx, dialer, tarantool.Opts{})
	if err != nil {
		log.Fatalf("Failed to connect: %s", err)
	}

	// Create SchemaUser.
	schemaUser := box.MustNew(client).Schema().User()

	// Create a new user.
	username := "new_user"
	options := box.UserCreateOptions{
		IfNotExists: true,
		Password:    "secure_password",
	}
	err = schemaUser.Create(ctx, username, options)
	if err != nil {
		log.Fatalf("Failed to create user: %s", err)
	}

	fmt.Printf("User '%s' created successfully\n", username)
}
Output:
User 'new_user' created successfully

func (*SchemaUser) Drop

func (u *SchemaUser) Drop(ctx context.Context, username string, options UserDropOptions) error

Drop drops the specified user from Tarantool, with optional conditions.

Example
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/tarantool/go-tarantool/v3"
	"github.com/tarantool/go-tarantool/v3/box"
)

func main() {
	// Connect to Tarantool.
	dialer := tarantool.NetDialer{
		Address:  "127.0.0.1:3013",
		User:     "test",
		Password: "test",
	}
	ctx := context.Background()

	client, err := tarantool.Connect(ctx, dialer, tarantool.Opts{})
	if err != nil {
		log.Fatalf("Failed to connect: %s", err)
	}

	// Create SchemaUser.
	schemaUser := box.MustNew(client).Schema().User()

	// Drop an existing user.
	username := "new_user"
	options := box.UserDropOptions{
		IfExists: true,
	}
	err = schemaUser.Drop(ctx, username, options)
	if err != nil {
		log.Fatalf("Failed to drop user: %s", err)
	}

	exists, err := schemaUser.Exists(ctx, username)
	if err != nil {
		log.Fatalf("Failed to get user exists: %s", err)
	}

	fmt.Printf("User '%s' dropped successfully\n", username)
	fmt.Printf("User '%s' exists status: %v \n", username, exists)
}
Output:
User 'new_user' dropped successfully
User 'new_user' exists status: false

func (*SchemaUser) Exists

func (u *SchemaUser) Exists(ctx context.Context, username string) (bool, error)

Exists checks if the specified user exists in Tarantool.

Example
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/tarantool/go-tarantool/v3"
	"github.com/tarantool/go-tarantool/v3/box"
)

func main() {
	dialer := tarantool.NetDialer{
		Address:  "127.0.0.1:3013",
		User:     "test",
		Password: "test",
	}
	ctx := context.Background()

	client, err := tarantool.Connect(ctx, dialer, tarantool.Opts{})

	if err != nil {
		log.Fatalf("Failed to connect: %s", err)
	}

	// You can use UserExistsRequest type and call it directly.
	fut := client.Do(box.NewUserExistsRequest("user"))

	resp := &box.UserExistsResponse{}

	err = fut.GetTyped(resp)
	if err != nil {
		log.Fatalf("Failed get box schema user exists with error: %s", err)
	}

	// Or use simple User implementation.
	b := box.MustNew(client)

	exists, err := b.Schema().User().Exists(ctx, "user")
	if err != nil {
		log.Fatalf("Failed get box schema user exists with error: %s", err)
	}

	if exists != resp.Exists {
		log.Fatalf("Box schema users exists are not equal")
	}

	fmt.Printf("Box schema users exists are equal\n")
	fmt.Printf("Current exists state: %+v", exists)
}
Output:
Box schema users exists are equal
Current exists state: false

func (*SchemaUser) Grant

func (u *SchemaUser) Grant(ctx context.Context, username string, privilege Privilege,
	opts UserGrantOptions) error

Grant executes the user grant operation in Tarantool, returning an error if it fails.

func (*SchemaUser) Info

func (u *SchemaUser) Info(ctx context.Context, username string) ([]Privilege, error)

Info returns a list of user privileges according to the box.schema.user.info method call.

Example
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/tarantool/go-tarantool/v3"
	"github.com/tarantool/go-tarantool/v3/box"
)

func main() {
	// Connect to Tarantool.
	dialer := tarantool.NetDialer{
		Address:  "127.0.0.1:3013",
		User:     "test",
		Password: "test",
	}
	ctx := context.Background()

	client, err := tarantool.Connect(ctx, dialer, tarantool.Opts{})
	if err != nil {
		log.Fatalf("Failed to connect: %s", err)
	}

	// Create SchemaUser.
	schemaUser := box.MustNew(client).Schema().User()

	info, err := schemaUser.Info(ctx, "test")
	if err != nil {
		log.Fatalf("Failed to get password hash: %s", err)
	}

	hasPublic := false
	for _, i := range info {
		if i.Name == "public" && i.Type == box.PrivilegeRole {
			hasPublic = true
		}
	}

	if hasPublic {
		fmt.Printf("User have public privileges")
	}
}
Output:
User have public privileges

func (*SchemaUser) Passwd

func (u *SchemaUser) Passwd(ctx context.Context, args ...string) error

Passwd sends a request to set a password for a currently logged in or a specified user. A currently logged-in user can change their password using box.schema.user.passwd(password). An administrator can change the password of another user with box.schema.user.passwd(username, password).

func (*SchemaUser) Password

func (u *SchemaUser) Password(ctx context.Context, password string) (string, error)

Password sends a request to retrieve the user's password from Tarantool. It returns the password hash as a string or an error if the request fails. It works just like hash function.

Example
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/tarantool/go-tarantool/v3"
	"github.com/tarantool/go-tarantool/v3/box"
)

func main() {
	// Connect to Tarantool.
	dialer := tarantool.NetDialer{
		Address:  "127.0.0.1:3013",
		User:     "test",
		Password: "test",
	}
	ctx := context.Background()

	client, err := tarantool.Connect(ctx, dialer, tarantool.Opts{})
	if err != nil {
		log.Fatalf("Failed to connect: %s", err)
	}

	// Create SchemaUser.
	schemaUser := box.MustNew(client).Schema().User()

	// Get the password hash.
	password := "my-password"
	passwordHash, err := schemaUser.Password(ctx, password)
	if err != nil {
		log.Fatalf("Failed to get password hash: %s", err)
	}

	fmt.Printf("Password '%s' hash: %s", password, passwordHash)
}
Output:
Password 'my-password' hash: 3PHNAQGFWFo0KRfToxNgDXHj2i8=

func (*SchemaUser) Revoke

func (u *SchemaUser) Revoke(ctx context.Context, username string, privilege Privilege,
	opts UserRevokeOptions) error

Revoke executes the user revoke operation in Tarantool, returning an error if it fails.

type Session

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

Session struct represents a connection session to Tarantool.

func (*Session) Su

func (s *Session) Su(ctx context.Context, username string) error

Su method is used to switch the session to the specified username. It sends the request to Tarantool and returns an error.

type SessionSuRequest

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

SessionSuRequest struct wraps a Tarantool call request specifically for session switching.

func NewSessionSuRequest

func NewSessionSuRequest(username string) (SessionSuRequest, error)

NewSessionSuRequest creates a new SessionSuRequest for switching session to a specified username. It returns an error if any execute functions are provided, as they are not supported now.

func (SessionSuRequest) Async

func (req SessionSuRequest) Async() bool

Async returns whether the request expects a response.

func (SessionSuRequest) Body

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

Body fills an encoder with the request body.

func (SessionSuRequest) Context

Context sets a passed context to the request.

func (SessionSuRequest) Ctx

func (req SessionSuRequest) Ctx() context.Context

Ctx returns a context of the request.

func (SessionSuRequest) Response

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

Response creates a response for the request.

func (SessionSuRequest) Type

func (req SessionSuRequest) Type() iproto.Type

Type returns IPROTO type for the request.

type Upstream

type Upstream struct {
	// Status is replication status of the connection with the instance.
	Status string `msgpack:"status"`
	// Idle is the time (in seconds) since the last event was received.
	Idle float64 `msgpack:"idle"`
	// Peer contains instance n’s URI.
	Peer string `msgpack:"peer"`
	// Lag is the time difference between the local time of instance n,
	// recorded when the event was received, and the local time at another master
	// recorded when the event was written to the write-ahead log on that master.
	Lag float64 `msgpack:"lag"`
	// Message contains an error message in case of a degraded state; otherwise, it is nil.
	Message string `msgpack:"message,omitempty"`
	// SystemMessage contains an error message in case of a degraded state; otherwise, it is nil.
	SystemMessage string `msgpack:"system_message,omitempty"`
}

Upstream information.

type UserCreateOptions

type UserCreateOptions struct {
	// IfNotExists - if true, prevents an error if the user already exists.
	IfNotExists bool `msgpack:"if_not_exists"`
	// Password for the new user.
	Password string `msgpack:"password"`
}

UserCreateOptions represents options for creating a user in Tarantool.

type UserCreateRequest

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

UserCreateRequest represents a request to create a new user in Tarantool.

func NewUserCreateRequest

func NewUserCreateRequest(username string, options UserCreateOptions) UserCreateRequest

NewUserCreateRequest creates a new request to create a user with specified options.

func (UserCreateRequest) Async

func (req UserCreateRequest) Async() bool

Async returns whether the request expects a response.

func (UserCreateRequest) Body

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

Body fills an encoder with the request body.

func (UserCreateRequest) Context

Context sets a passed context to the request.

func (UserCreateRequest) Ctx

func (req UserCreateRequest) Ctx() context.Context

Ctx returns a context of the request.

func (UserCreateRequest) Response

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

Response creates a response for the request.

func (UserCreateRequest) Type

func (req UserCreateRequest) Type() iproto.Type

Type returns IPROTO type for the request.

type UserCreateResponse

type UserCreateResponse struct{}

UserCreateResponse represents the response to a user creation request.

func (*UserCreateResponse) DecodeMsgpack

func (uer *UserCreateResponse) DecodeMsgpack(_ *msgpack.Decoder) error

DecodeMsgpack decodes the response for a user creation request. In this case, the response does not contain any data.

type UserDropOptions

type UserDropOptions struct {
	IfExists bool `msgpack:"if_exists"` // If true, prevents an error if the user does not exist.
}

UserDropOptions represents options for dropping a user in Tarantool.

type UserDropRequest

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

UserDropRequest represents a request to drop a user from Tarantool.

func NewUserDropRequest

func NewUserDropRequest(username string, options UserDropOptions) UserDropRequest

NewUserDropRequest creates a new request to drop a user with specified options.

func (UserDropRequest) Async

func (req UserDropRequest) Async() bool

Async returns whether the request expects a response.

func (UserDropRequest) Body

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

Body fills an encoder with the request body.

func (UserDropRequest) Context

Context sets a passed context to the request.

func (UserDropRequest) Ctx

func (req UserDropRequest) Ctx() context.Context

Ctx returns a context of the request.

func (UserDropRequest) Response

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

Response creates a response for the request.

func (UserDropRequest) Type

func (req UserDropRequest) Type() iproto.Type

Type returns IPROTO type for the request.

type UserDropResponse

type UserDropResponse struct{}

UserDropResponse represents the response to a user drop request.

type UserExistsRequest

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

UserExistsRequest represents a request to check if a user exists in Tarantool.

func NewUserExistsRequest

func NewUserExistsRequest(username string) UserExistsRequest

NewUserExistsRequest creates a new request to check if a user exists.

func (UserExistsRequest) Async

func (req UserExistsRequest) Async() bool

Async returns whether the request expects a response.

func (UserExistsRequest) Body

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

Body fills an encoder with the request body.

func (UserExistsRequest) Context

Context sets a passed context to the request.

func (UserExistsRequest) Ctx

func (req UserExistsRequest) Ctx() context.Context

Ctx returns a context of the request.

func (UserExistsRequest) Response

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

Response creates a response for the request.

func (UserExistsRequest) Type

func (req UserExistsRequest) Type() iproto.Type

Type returns IPROTO type for the request.

type UserExistsResponse

type UserExistsResponse struct {
	Exists bool // True if the user exists, false otherwise.
}

UserExistsResponse represents the response to a user existence check.

func (*UserExistsResponse) DecodeMsgpack

func (uer *UserExistsResponse) DecodeMsgpack(d *msgpack.Decoder) error

DecodeMsgpack decodes the response from a Msgpack-encoded byte slice.

type UserGrantOptions

type UserGrantOptions struct {
	Grantor     string `msgpack:"grantor,omitempty"` // Optional grantor name.
	IfNotExists bool   `msgpack:"if_not_exists"`     // Option to skip if the grant already exists.
}

UserGrantOptions holds options for granting permissions to a user.

type UserGrantRequest

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

UserGrantRequest wraps a Tarantool call request for granting user permissions.

func NewUserGrantRequest

func NewUserGrantRequest(username string, privilege Privilege,
	opts UserGrantOptions) UserGrantRequest

NewUserGrantRequest creates a new UserGrantRequest based on provided parameters.

func (UserGrantRequest) Async

func (req UserGrantRequest) Async() bool

Async returns whether the request expects a response.

func (UserGrantRequest) Body

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

Body fills an encoder with the request body.

func (UserGrantRequest) Context

Context sets a passed context to the request.

func (UserGrantRequest) Ctx

func (req UserGrantRequest) Ctx() context.Context

Ctx returns a context of the request.

func (UserGrantRequest) Response

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

Response creates a response for the request.

func (UserGrantRequest) Type

func (req UserGrantRequest) Type() iproto.Type

Type returns IPROTO type for the request.

type UserGrantResponse

type UserGrantResponse struct{}

UserGrantResponse represents the response from a user grant request.

type UserInfoRequest

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

UserInfoRequest represents a request to get a user's info in Tarantool.

func NewUserInfoRequest

func NewUserInfoRequest(username string) UserInfoRequest

NewUserInfoRequest creates a new request to get user privileges.

func (UserInfoRequest) Async

func (req UserInfoRequest) Async() bool

Async returns whether the request expects a response.

func (UserInfoRequest) Body

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

Body fills an encoder with the request body.

func (UserInfoRequest) Context

Context sets a passed context to the request.

func (UserInfoRequest) Ctx

func (req UserInfoRequest) Ctx() context.Context

Ctx returns a context of the request.

func (UserInfoRequest) Response

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

Response creates a response for the request.

func (UserInfoRequest) Type

func (req UserInfoRequest) Type() iproto.Type

Type returns IPROTO type for the request.

type UserInfoResponse

type UserInfoResponse struct {
	Privileges []Privilege
}

UserInfoResponse represents the response to a user info request.

func (*UserInfoResponse) DecodeMsgpack

func (uer *UserInfoResponse) DecodeMsgpack(d *msgpack.Decoder) error

DecodeMsgpack decodes the response from Tarantool in Msgpack format.

type UserPasswdRequest

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

UserPasswdRequest represents a request to change a user's password in Tarantool.

func NewUserPasswdRequest

func NewUserPasswdRequest(args ...string) (UserPasswdRequest, error)

NewUserPasswdRequest creates a new request to change a user's password in Tarantool.

func (UserPasswdRequest) Async

func (req UserPasswdRequest) Async() bool

Async returns whether the request expects a response.

func (UserPasswdRequest) Body

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

Body fills an encoder with the request body.

func (UserPasswdRequest) Context

Context sets a passed context to the request.

func (UserPasswdRequest) Ctx

func (req UserPasswdRequest) Ctx() context.Context

Ctx returns a context of the request.

func (UserPasswdRequest) Response

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

Response creates a response for the request.

func (UserPasswdRequest) Type

func (req UserPasswdRequest) Type() iproto.Type

Type returns IPROTO type for the request.

type UserPasswdResponse

type UserPasswdResponse struct{}

UserPasswdResponse represents the response to a user passwd request.

type UserPasswordRequest

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

UserPasswordRequest represents a request to retrieve a user's password from Tarantool.

func NewUserPasswordRequest

func NewUserPasswordRequest(username string) UserPasswordRequest

NewUserPasswordRequest creates a new request to fetch the user's password. It takes the username and constructs the request to Tarantool.

func (UserPasswordRequest) Async

func (req UserPasswordRequest) Async() bool

Async returns whether the request expects a response.

func (UserPasswordRequest) Body

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

Body fills an encoder with the request body.

func (UserPasswordRequest) Context

Context sets a passed context to the request.

func (UserPasswordRequest) Ctx

func (req UserPasswordRequest) Ctx() context.Context

Ctx returns a context of the request.

func (UserPasswordRequest) Response

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

Response creates a response for the request.

func (UserPasswordRequest) Type

func (req UserPasswordRequest) Type() iproto.Type

Type returns IPROTO type for the request.

type UserPasswordResponse

type UserPasswordResponse struct {
	Hash string // The password hash of the user.
}

UserPasswordResponse represents the response to the user password request. It contains the password hash.

func (*UserPasswordResponse) DecodeMsgpack

func (upr *UserPasswordResponse) DecodeMsgpack(d *msgpack.Decoder) error

DecodeMsgpack decodes the response from Tarantool in Msgpack format. It expects the response to be an array of length 1, containing the password hash string.

type UserRevokeOptions

type UserRevokeOptions struct {
	IfExists bool `msgpack:"if_exists"` // Option to skip if the revoke does not exist.
}

UserRevokeOptions holds options for revoking permissions from a user.

type UserRevokeRequest

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

UserRevokeRequest wraps a Tarantool call request for revoking user permissions.

func NewUserRevokeRequest

func NewUserRevokeRequest(username string, privilege Privilege,
	opts UserRevokeOptions) UserRevokeRequest

NewUserRevokeRequest creates a new UserRevokeRequest based on provided parameters.

func (UserRevokeRequest) Async

func (req UserRevokeRequest) Async() bool

Async returns whether the request expects a response.

func (UserRevokeRequest) Body

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

Body fills an encoder with the request body.

func (UserRevokeRequest) Context

Context sets a passed context to the request.

func (UserRevokeRequest) Ctx

func (req UserRevokeRequest) Ctx() context.Context

Ctx returns a context of the request.

func (UserRevokeRequest) Response

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

Response creates a response for the request.

func (UserRevokeRequest) Type

func (req UserRevokeRequest) Type() iproto.Type

Type returns IPROTO type for the request.

type UserRevokeResponse

type UserRevokeResponse struct{}

UserRevokeResponse represents the response from a user revoke request.

Jump to

Keyboard shortcuts

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