v1

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

func NewScdbConn

func NewScdbConn(addr string) (*Conn, error)

Creates a connection to the scdb. address format host:port example 127.0.0.1:50051

func (*Conn) Begin

func (c *Conn) Begin() *Transaction

Begin SCDB transaction, return nil is begin error

func (*Conn) Close

func (c *Conn) Close() error

Closes the connection.

func (*Conn) Del

func (c *Conn) Del(ctx context.Context, key string) error

Deletes data based on the key. If successful, it returns nil, and if it fails, it returns an error.

func (*Conn) Get

func (c *Conn) Get(ctx context.Context, key string) ([]byte, error)

Based on the key, it retrieves the value. If the retrieval fails, it returns an error, and if successful, it returns the value associated with the key.

func (*Conn) Ping

func (c *Conn) Ping(ctx context.Context) error

Ping-Pong connection, when the connection is established returns nil. but when the connection is closed returns error

func (*Conn) Save

func (c *Conn) Save(ctx context.Context, key string, value []byte) error

Stores a value using a key and value. If the storage fails, it returns an error, and if successful, it returns nil.

type Transaction

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

func (*Transaction) Commit

func (t *Transaction) Commit() error

Commit SCDB transaction

func (*Transaction) Del

func (t *Transaction) Del(ctx context.Context, key string) error

Deletes data based on the key. If successful, it returns nil, and if it fails, it returns an error.

func (*Transaction) Get

func (t *Transaction) Get(ctx context.Context, key string) ([]byte, error)

Based on the key, it retrieves the value. If the retrieval fails, it returns an error, and if successful, it returns the value associated with the key.

func (*Transaction) Rollback

func (t *Transaction) Rollback()

Rollback SCDB transaction

func (*Transaction) Save

func (t *Transaction) Save(ctx context.Context, key string, value []byte) error

Stores a value using a key and value. If the storage fails, it returns an error, and if successful, it returns nil.

Jump to

Keyboard shortcuts

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