Documentation ¶
Index ¶
- Constants
- Variables
- 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])
- type AttachToObjectOptions
- type Client
- func (c *Client) ChangeLevel(ctx context.Context, login string, level Level) (res gost.ResultN)
- func (c *Client) ChangePassword(ctx context.Context, login, newPassword string) (res gost.ResultN)
- func (c *Client) DelOne(ctx context.Context, key string, opts ...DeleteOptions) gost.ResultN
- 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) NewUser(ctx context.Context, login, password string, opts ...NewUserOptions) (res gost.ResultN)
- func (c *Client) Object(name string) *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.ResultN)
- func (c *Client) SetManyOpts(ctx context.Context, keyValue map[string]ValueSpec) (res gost.ResultN)
- 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.ResultN)
- func (c *Client) StructToObject(ctx context.Context, name string, structure any) (*Object, error)
- type Config
- type ConnectOptions
- type Credentials
- type DeleteKeyOptions
- type DeleteObjectOptions
- type DeleteOptions
- type GetFromObjectOptions
- type GetOptions
- type IsObjectOptions
- type KeySpec
- type Level
- type NewUserOptions
- type Object
- func (o *Object) Attach(ctx context.Context, name string, opts ...AttachToObjectOptions) (res gost.ResultN)
- func (o *Object) Create(ctx context.Context, opts ...ObjectOptions) (res gost.Result[int32])
- func (o *Object) DeleteKey(ctx context.Context, key string, opts ...DeleteKeyOptions) (res gost.ResultN)
- func (o *Object) DeleteObject(ctx context.Context, opts ...DeleteObjectOptions) (res gost.ResultN)
- func (o *Object) Get(ctx context.Context, key string, opts ...GetFromObjectOptions) (res gost.Result[string])
- func (o *Object) Is(ctx context.Context) (res gost.Result[bool])
- func (o *Object) JSON(ctx context.Context, opts ...ObjectToJSONOptions) (res gost.Result[string])
- func (o *Object) Name() string
- func (o *Object) Object(name string) *Object
- func (o *Object) Server() int32
- func (o *Object) Set(ctx context.Context, key, value string, opts ...SetToObjectOptions) (res gost.Result[int32])
- func (o *Object) Size(ctx context.Context, opts ...SizeOptions) (res gost.Result[uint64])
- type ObjectOptions
- type ObjectToJSONOptions
- type Options
- type RAM
- type SetOptions
- type SetToObjectOptions
- type SizeOptions
- type Value
- type ValueSpec
Constants ¶
View Source
const ( DefaultUser = "itisadb" DefaultPassword = "itisadb" )
View Source
const ObjectSeparator = "."
Variables ¶
View Source
var ( ErrNotFound = gost.NewErrX(0, "not found") ErrObjectNotFound = gost.NewErrX(0, "object not found") ErrUniqueConstraint = gost.NewErrX(0, "unique constraint failed") ErrPermissionDenied = gost.NewErrX(0, "permission denied") ErrContextCanceled = gost.NewErrX(0, "context canceled") )
View Source
var ErrWrongTypeParameter = fmt.Errorf("wrong type parameter")
View Source
var Internal internal
Functions ¶
Types ¶
type AttachToObjectOptions ¶
type AttachToObjectOptions struct {
Server int32
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ChangeLevel ¶
func (*Client) ChangePassword ¶
func (*Client) DeleteUser ¶
func (*Client) GetMany ¶
func (c *Client) GetMany(ctx context.Context, keys []string, opts ...GetOptions) (res gost.Result[map[string]Value])
GetMany gets a lot of values from gRPCis.
func (*Client) GetManyOpts ¶
func (c *Client) GetManyOpts(ctx context.Context, keys []KeySpec) (res gost.Result[map[string]Value])
GetManyOpts gets a lot of values from gRPCis with opts.
func (*Client) GetOne ¶
func (c *Client) GetOne(ctx context.Context, key string, opts ...GetOptions) (res gost.Result[Value])
GetOne gets the value by the key from gRPCis.
func (*Client) ObjectToStruct ¶
ObjectToStruct creates a struct from an object. Supported field types: Strings, Ints, Uints, Pointers to structs, Structs, Booleans, Floats.
DO NOT USE CYCLIC STRUCTURES.
func (*Client) SetMany ¶
func (c *Client) SetMany(ctx context.Context, kv map[string]string, opts ...SetOptions) (res gost.ResultN)
SetMany sets a set of vals for gRPCis.
func (*Client) SetManyOpts ¶
SetManyOpts gets a lot of vals from gRPCis with opts.
func (*Client) SetOne ¶
func (c *Client) SetOne(ctx context.Context, key, val string, opts ...SetOptions) (res gost.Result[int32])
SetOne sets the val for the key to gRPCis.
type Config ¶
type Config struct {
Credentials Credentials
}
type ConnectOptions ¶
type ConnectOptions struct {
Server int32
}
type Credentials ¶
type DeleteKeyOptions ¶
type DeleteKeyOptions struct {
Server int32
}
type DeleteObjectOptions ¶
type DeleteObjectOptions struct {
Server int32
}
type DeleteOptions ¶
type DeleteOptions struct {
Server int32
}
type GetFromObjectOptions ¶
type GetFromObjectOptions struct {
Server int32
}
type GetOptions ¶
type GetOptions struct {
Server int32
}
type IsObjectOptions ¶
type IsObjectOptions struct {
Server int32
}
type KeySpec ¶ added in v0.13.0
type KeySpec struct { Key string Options GetOptions }
type NewUserOptions ¶ added in v0.15.8
type NewUserOptions struct {
Level Level
}
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
func (*Object) Attach ¶
func (o *Object) Attach(ctx context.Context, name string, opts ...AttachToObjectOptions) (res gost.ResultN)
Attach attaches the object to another object.
func (*Object) DeleteKey ¶
func (o *Object) DeleteKey(ctx context.Context, key string, opts ...DeleteKeyOptions) (res gost.ResultN)
DeleteKey deletes the attribute from the object.
func (*Object) DeleteObject ¶
DeleteObject deletes the object.
func (*Object) Get ¶
func (o *Object) Get(ctx context.Context, key string, opts ...GetFromObjectOptions) (res gost.Result[string])
Get gets the value for the key from the specified object.
type ObjectOptions ¶
type ObjectToJSONOptions ¶
type ObjectToJSONOptions struct {
Server int32
}
type SetToObjectOptions ¶
type SizeOptions ¶
type SizeOptions struct {
Server int32
}
type Value ¶
func (Value) MarshalJSON ¶ added in v0.15.2
type ValueSpec ¶ added in v0.13.0
type ValueSpec struct { Value string Options SetOptions }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.