itisadb

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: MIT Imports: 10 Imported by: 1

README

itisadb-go-sdk - itisadb Driver and Toolkit PkgGoDev

itisadb is a system consisting of several microservices (Memory Balancer, Storage, WebApplication), which is a distributed key-value database.

Documentation

Installation

go get github.com/egorgasay/itisadb-go-sdk

Quick start

package main

import (
	"context"
	"github.com/egorgasay/itisadb-go-sdk"
	"log"
)

// main to run this test, itisadb must be run on :800.
func main() {
	db, err := itisadb.New(":800")
	if err != nil {
		return
	}

	ctx := context.TODO()
	err = db.SetOne(ctx, "qwe", "111", false)
	if err != nil {
		log.Fatalln(err)
	}

	get, err := db.GetOne(ctx, "qwe")
	if err != nil {
		log.Fatalln(err)
	}

	if get != "111" {
		log.Fatal("Wrong value")
	} else {
		log.Println("Value:", get)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUniqueConstraint = errors.New("unique constraint failed")

Functions

This section is empty.

Types

type Client

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

func New

func New(balancerIP string, credentials ...gcredentials.TransportCredentials) (*Client, error)

func (*Client) GetFrom added in v0.1.2

func (c *Client) GetFrom(ctx context.Context, key string, server int32) (string, error)

GetFrom gets the value by key from the specified server.

func (*Client) GetFromDB added in v0.1.2

func (c *Client) GetFromDB(ctx context.Context, key string) (string, error)

GetFromDB gets the value by key from the physical database.

func (*Client) GetMany

func (c *Client) GetMany(ctx context.Context, keys []string) (map[string]string, error)

GetMany gets a lot of values from gRPCis.

func (*Client) GetManyOpts

func (c *Client) GetManyOpts(ctx context.Context, keys []Key) (map[string]string, error)

GetManyOpts gets a lot of values from gRPCis with opts.

func (*Client) GetOne

func (c *Client) GetOne(ctx context.Context, key string) (string, error)

GetOne gets the value by the key from gRPCis.

func (*Client) Index added in v0.2.1

func (c *Client) Index(ctx context.Context, name string) (*Index, error)

Index creates a new area.

func (*Client) IsIndex added in v0.3.0

func (c *Client) IsIndex(ctx context.Context, name string) (bool, error)

IsIndex checks if it is an index or not.

func (*Client) SetMany

func (c *Client) SetMany(ctx context.Context, keyValue map[string]string, uniques bool) error

SetMany sets a set of values for gRPCis.

func (*Client) SetManyOpts

func (c *Client) SetManyOpts(ctx context.Context, keyValue map[string]Value, uniques bool) error

SetManyOpts gets a lot of values from gRPCis with opts.

func (*Client) SetOne

func (c *Client) SetOne(ctx context.Context, key, value string, uniques bool) error

SetOne sets the value for the key to gRPCis.

func (*Client) SetTo added in v0.1.2

func (c *Client) SetTo(ctx context.Context, key, value string, server int32, uniques bool) error

SetTo sets the value for the key on the specified server.

func (*Client) SetToAll

func (c *Client) SetToAll(ctx context.Context, key, value string, uniques bool) error

SetToAll sets the value for the key on all servers.

func (*Client) SetToAllAndToDB added in v0.1.2

func (c *Client) SetToAllAndToDB(ctx context.Context, key, value string, uniques bool) error

SetToAllAndToDB sets the value for the key on all servers and in th physical database.

func (*Client) SetToDB added in v0.1.2

func (c *Client) SetToDB(ctx context.Context, key, value string, uniques bool) error

SetToDB sets the value for the key in the physical database.

type Index added in v0.2.1

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

func (*Index) Get added in v0.2.1

func (i *Index) Get(ctx context.Context, key string) (string, error)

Get gets the value for the key from the specified index.

func (*Index) GetIndex added in v0.3.0

func (i *Index) GetIndex(ctx context.Context) (map[string]string, error)

GetIndex returns the index.

func (*Index) GetName added in v0.3.0

func (i *Index) GetName() string

GetName returns the name of the index.

func (*Index) Index added in v0.2.1

func (i *Index) Index(ctx context.Context, name string) (*Index, error)

Index returns a new or an existing index.

func (*Index) Set added in v0.2.1

func (i *Index) Set(ctx context.Context, key, value string, uniques bool) (int32, error)

Set sets the value for the key in the specified index.

type Key

type Key struct {
	Key  string
	Opts Opts
}

type Opts added in v0.1.2

type Opts struct {
	Server int32
}

type Value

type Value struct {
	Value string
	Opts  Opts
}

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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