Versions in this module Expand all Collapse all v0 v0.14.0 Jan 3, 2024 v0.13.0 Jan 3, 2024 Changes in this version + const DefaultPassword + const DefaultUser + var ErrNotFound = gost.NewError(0, 0, "not found") + var ErrObjectNotFound = gost.NewError(0, 0, "object not found") + var ErrPermissionDenied = gost.NewError(0, 0, "permission denied") + var ErrUnauthorized = gost.NewError(0, 0, "unauthorized") + var ErrUnavailable = gost.NewError(0, 0, "storage is unavailable") + var ErrUniqueConstraint = gost.NewError(0, 0, "unique constraint failed") + var ErrWrongTypeParameter = fmt.Errorf("wrong type parameter") + var Internal internal + func GetCmp[V comparable](ctx context.Context, from getter, key string) (val V, err error) + func New(ctx context.Context, balancerIP string, conf ...Config) (res gost.Result[*Client]) + func ToServerNumber(x int) *int32 + type AttachToObjectOptions struct + Server *int32 + type Client struct + func (c *Client) ChangeLevel(ctx context.Context, login string, level Level) error + func (c *Client) ChangePassword(ctx context.Context, login, newPassword string) error + func (c *Client) CreateUser(ctx context.Context, login, password string, opts ...CreateUserOptions) (res gost.Result[gost.Nothing]) + func (c *Client) DelOne(ctx context.Context, key string, opts ...DeleteOptions) gost.Result[gost.Nothing] + func (c *Client) DeleteUser(ctx context.Context, login string) (res gost.Result[bool]) + func (c *Client) GetMany(ctx context.Context, keys []string, opts ...GetOptions) (res gost.Result[map[string]Value]) + func (c *Client) GetManyOpts(ctx context.Context, keys []KeySpec) (res gost.Result[map[string]Value]) + func (c *Client) GetOne(ctx context.Context, key string, opts ...GetOptions) (res gost.Result[Value]) + func (c *Client) IsObject(ctx context.Context, name string) (res gost.Result[bool]) + func (c *Client) Object(ctx context.Context, name string, opts ...ObjectOptions) (res gost.Result[*Object]) + func (c *Client) ObjectToStruct(ctx context.Context, name string, data any) error + func (c *Client) SetMany(ctx context.Context, kv map[string]string, opts ...SetOptions) (res gost.Result[gost.Nothing]) + func (c *Client) SetManyOpts(ctx context.Context, keyValue map[string]ValueSpec) (res gost.Result[gost.Nothing]) + func (c *Client) SetOne(ctx context.Context, key, val string, opts ...SetOptions) (res gost.Result[int32]) + func (c *Client) SetToAll(ctx context.Context, key, val string, opts ...SetOptions) (res gost.Result[gost.Nothing]) + func (c *Client) StructToObject(ctx context.Context, name string, structure any) (*Object, error) + type Config struct + Credentials Credentials + type ConnectOptions struct + Server *int32 + type CreateUserOptions struct + Level Level + type Credentials struct + Login string + Password string + type DeleteKeyOptions struct + Server *int32 + type DeleteObjectOptions struct + Server *int32 + type DeleteOptions struct + Server *int32 + type GetFromObjectOptions struct + Server *int32 + type GetOptions struct + Server *int32 + type IsObjectOptions struct + Server *int32 + type KeySpec struct + Key string + Options GetOptions + type Level byte + const DefaultLevel + const RestrictedLevel + const SecretLevel + type Object struct + func (i *Object) Attach(ctx context.Context, name string, opts ...AttachToObjectOptions) (res gost.Result[gost.Nothing]) + func (i *Object) DeleteKey(ctx context.Context, key string, opts ...DeleteKeyOptions) (res gost.Result[gost.Nothing]) + func (i *Object) DeleteObject(ctx context.Context, opts ...DeleteObjectOptions) (res gost.Result[gost.Nothing]) + func (i *Object) Get(ctx context.Context, key string, opts ...GetFromObjectOptions) (res gost.Result[string]) + func (i *Object) JSON(ctx context.Context, opts ...ObjectToJSONOptions) (res gost.Result[string]) + func (i *Object) Name() string + func (i *Object) Object(ctx context.Context, name string, opts ...ObjectOptions) (res gost.Result[*Object]) + func (i *Object) Set(ctx context.Context, key, value string, opts ...SetToObjectOptions) (res gost.Result[int32]) + func (i *Object) Size(ctx context.Context, opts ...SizeOptions) (res gost.Result[uint64]) + type ObjectOptions struct + Level Level + Server *int32 + type ObjectToJSONOptions struct + Server *int32 + type Options struct + Server int32 + Unique bool + type RAM struct + Available uint64 + Total uint64 + type SetOptions struct + Level Level + ReadOnly bool + Server *int32 + Unique bool + type SetToObjectOptions struct + ReadOnly bool + Server *int32 + type SizeOptions struct + Server *int32 + type Value struct + Level Level + ReadOnly bool + Value string + type ValueSpec struct + Options SetOptions + Value string