gocql

package
v1.0.0-beta.41 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginsRoot = root + ".plugins"
)

Variables

This section is empty.

Functions

func ConfigAdd

func ConfigAdd(path string)

func NewSession

func NewSession(ctx context.Context, plugins ...Plugin) (*gocql.Session, error)

NewSession returns a new session with default options.

func NewSessionWithConfigPath

func NewSessionWithConfigPath(ctx context.Context, path string, plugins ...Plugin) (*gocql.Session, error)

NewSessionWithConfigPath returns a new session with options from config path.

func NewSessionWithOptions

func NewSessionWithOptions(ctx context.Context, o *Options, plugins ...Plugin) (session *gocql.Session, err error)

NewSessionWithOptions returns a new session with options.

Types

type ManagedSession

type ManagedSession struct {
	Session *gocql.Session
	Plugins []Plugin
	Options *Options
}

ManagedSession represents a gocqsl managed session

func NewManagedSession

func NewManagedSession(ctx context.Context, plugins ...Plugin) (*ManagedSession, error)

NewManagedSession returns a ManagedSession with default options.

func NewManagedSessionWithConfigPath

func NewManagedSessionWithConfigPath(ctx context.Context, path string, plugins ...Plugin) (*ManagedSession, error)

NewManagedSessionWithConfigPath returns a ManagedSession with options from config path.

func NewManagedSessionWithOptions

func NewManagedSessionWithOptions(ctx context.Context, opts *Options, plugins ...Plugin) (*ManagedSession, error)

NewManagedSessionWithOptions returns a ManagedSession with options.

type Options

type Options struct {
	Hosts                    []string
	Port                     int
	DC                       string `config:"dc"`
	Username                 string
	Password                 string
	CQLVersion               string `config:"CQLVersion"`
	ProtoVersion             int
	Timeout                  time.Duration
	ConnectTimeout           time.Duration
	Keyspace                 string
	NumConns                 int
	Consistency              string
	SocketKeepalive          time.Duration
	MaxPreparedStmts         int
	MaxRoutingKeyInfo        int
	PageSize                 int
	DefaultTimestamp         bool
	ReconnectInterval        time.Duration
	MaxWaitSchemaAgreement   time.Duration
	DisableInitialHostLookup bool
	WriteCoalesceWaitTime    time.Duration
}

Options represents gocql options.

func NewOptions

func NewOptions() (*Options, error)

NewOptions returns options from config file or environment vars.

func NewOptionsWithPath

func NewOptionsWithPath(path string) (opts *Options, err error)

NewOptionsWithPath unmarshals options based a given key path.

type Plugin

type Plugin func(context.Context, *gocql.Session) error

Plugin defines a gocql plugin signature.

Directories

Path Synopsis
examples
plugins

Jump to

Keyboard shortcuts

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