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])
- func ToServerNumber(x int) *int32
- type AttachToObjectOptions
- type Client
- 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]string])
- func (c *Client) GetManyOpts(ctx context.Context, keys []Key) (res gost.Result[map[string]string])
- func (c *Client) GetOne(ctx context.Context, key string, opts ...GetOptions) (res gost.Result[string])
- 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]Value) (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
- type ConnectOptions
- type CreateUserOptions
- type Credentials
- type DeleteKeyOptions
- type DeleteObjectOptions
- type DeleteOptions
- type GetFromObjectOptions
- type GetOptions
- type IsObjectOptions
- type Key
- type Level
- type Object
- 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
- type ObjectToJSONOptions
- type Options
- type SetOptions
- type SetToObjectOptions
- type SizeOptions
- type Value
Constants ¶
const ( DefaultUser = "itisadb" DefaultPassword = "itisadb" )
Variables ¶
var ( ErrNotFound = gost.NewError(0, 0, "not found") ErrObjectNotFound = gost.NewError(0, 0, "object not found") ErrUniqueConstraint = gost.NewError(0, 0, "unique constraint failed") ErrPermissionDenied = gost.NewError(0, 0, "permission denied") )
var ErrWrongTypeParameter = fmt.Errorf("wrong type parameter")
Functions ¶
func GetCmp ¶
func GetCmp[V comparable](ctx context.Context, from getter, key string) (val V, err error)
func ToServerNumber ¶
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) CreateUser ¶
func (*Client) DeleteUser ¶
func (*Client) GetMany ¶
func (c *Client) GetMany(ctx context.Context, keys []string, opts ...GetOptions) (res gost.Result[map[string]string])
GetMany gets a lot of values from gRPCis.
func (*Client) GetManyOpts ¶
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[string])
GetOne gets the value by the key from gRPCis.
func (*Client) Object ¶
func (c *Client) Object(ctx context.Context, name string, opts ...ObjectOptions) (res gost.Result[*Object])
Object creates a new object.
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.Result[gost.Nothing])
SetMany sets a set of vals for gRPCis.
func (*Client) SetManyOpts ¶
func (c *Client) SetManyOpts(ctx context.Context, keyValue map[string]Value) (res gost.Result[gost.Nothing])
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 CreateUserOptions ¶
type CreateUserOptions struct {
Level Level
}
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 Key ¶
type Key struct { Key string Options GetOptions }
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
func (*Object) Attach ¶
func (i *Object) Attach(ctx context.Context, name string, opts ...AttachToObjectOptions) (res gost.Result[gost.Nothing])
Attach attaches the object to another object.
func (*Object) DeleteKey ¶
func (i *Object) DeleteKey(ctx context.Context, key string, opts ...DeleteKeyOptions) (res gost.Result[gost.Nothing])
DeleteKey deletes the attribute from the object.
func (*Object) DeleteObject ¶
func (i *Object) DeleteObject(ctx context.Context, opts ...DeleteObjectOptions) (res gost.Result[gost.Nothing])
DeleteObject deletes the object.
func (*Object) Get ¶
func (i *Object) Get(ctx context.Context, key string, opts ...GetFromObjectOptions) (res gost.Result[string])
Get gets the value for the key from the specified object.
func (*Object) Object ¶
func (i *Object) Object(ctx context.Context, name string, opts ...ObjectOptions) (res gost.Result[*Object])
Object returns a new or an existing object.
type ObjectOptions ¶
type ObjectToJSONOptions ¶
type ObjectToJSONOptions struct {
Server *int32
}
type SetToObjectOptions ¶
type SizeOptions ¶
type SizeOptions struct {
Server *int32
}
type Value ¶
type Value struct { Value string Options SetOptions }