cqldb

package
v2.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort = 9142

	NullValue = "null"

	UUIDType   = "UUID"
	Int64Type  = "bigint"
	BytesType  = "blob"
	StringType = "text"

	WhereClause = "WHERE"
	FromClause  = "FROM"

	SelectCommand = "SELECT"
)

Variables

This section is empty.

Functions

func EncodeToBlob

func EncodeToBlob(data []byte, buffer *strings.Builder)

Types

type Client

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

Client implements an Client for CqlDB.

func New

func New(ctx context.Context, cfg Config, tls *tls.Config, logger log.Logger, _ trace.TracerProvider) (*Client, error)

NewStore creates a new Client.

func (*Client) AddCloseFunc

func (s *Client) AddCloseFunc(f func())

func (*Client) Clear

func (s *Client) Clear(ctx context.Context) error

Clear clears the event storage.

func (*Client) Close

func (s *Client) Close()

Close closes the database session.

func (*Client) CreateIndexes

func (s *Client) CreateIndexes(ctx context.Context, table string, indexes []Index) error

func (*Client) DropKeyspace

func (s *Client) DropKeyspace(ctx context.Context) error

Drops the whole database

func (*Client) DropTable

func (s *Client) DropTable(ctx context.Context, table string) error

Drops selected collection from database

func (*Client) Keyspace

func (s *Client) Keyspace() string

func (*Client) Session

func (s *Client) Session() *gocql.Session

Get mongodb client

func (*Client) SetOnClear

func (s *Client) SetOnClear(onClear OnClearFn)

Set the function called on Clear

type Config

type Config struct {
	Hosts                 []string                 `yaml:"hosts" json:"hosts"`
	Port                  int                      `yaml:"port" json:"port"`
	NumConns              int                      `yaml:"numConnections" json:"numConnections"`
	ConnectTimeout        time.Duration            `yaml:"connectTimeout" json:"connectTimeout"`
	ReconnectionPolicy    ReconnectionPolicyConfig `yaml:"reconnectionPolicy" json:"reconnectionPolicy"`
	UseHostnameResolution bool                     `yaml:"useHostnameResolution" json:"useHostnameResolution"`
	Keyspace              KeyspaceConfig           `yaml:"keyspace" json:"keyspace"`
	TLS                   client.Config            `yaml:"tls" json:"tls"`
}

func (*Config) Validate

func (c *Config) Validate() error

type ConstantReconnectionPolicyConfig

type ConstantReconnectionPolicyConfig struct {
	Interval   time.Duration `yaml:"interval" json:"interval"`
	MaxRetries int           `yaml:"maxRetries" json:"maxRetries"`
}

func (*ConstantReconnectionPolicyConfig) Validate

type Index

type Index struct {
	Name            string
	PartitionKey    string
	SecondaryColumn string
}

type KeyspaceConfig

type KeyspaceConfig struct {
	Name        string                 `yaml:"name" json:"name"`
	Create      bool                   `yaml:"create" json:"create"`
	Replication map[string]interface{} `yaml:"replication" json:"replication"`
}

func (*KeyspaceConfig) Validate

func (c *KeyspaceConfig) Validate() error

type OnClearFn

type OnClearFn = func(context.Context) error

type ReconnectionPolicyConfig

type ReconnectionPolicyConfig struct {
	Constant ConstantReconnectionPolicyConfig `yaml:"constant" json:"constant"`
}

func (*ReconnectionPolicyConfig) Validate

func (c *ReconnectionPolicyConfig) Validate() error

Jump to

Keyboard shortcuts

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