dbconnector

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrepareTLSConfig

func PrepareTLSConfig(caFile, certFile, keyFile string) (*tls.Config, error)

PrepareTLSConfig creates tls.Config with certificate files

Types

type LazyRethinkSession

type LazyRethinkSession struct {
	*r.Session
	// contains filtered or unexported fields
}

LazyRethinkSession is a connection to the rethinkdb. It implements r.QueryExecutor interface. It will make attempt to connect with first call and reconnect after every error.

func ConnectRethinkDB

func ConnectRethinkDB(
	addresses []string,
	username, password string,
	tlsConfig *tls.Config,
	poolSize int,
) *LazyRethinkSession

ConnectRethinkDB establishes lazy rethinkdb connection It will make attempt to connect with first call and reconnect after every error

func (*LazyRethinkSession) Close

func (l *LazyRethinkSession) Close() error

Close closes connections

func (*LazyRethinkSession) Exec

func (l *LazyRethinkSession) Exec(ctx context.Context, q r.Query) error

Exec executes a ReQL query using the session to connect to the database

func (*LazyRethinkSession) IsConnected

func (l *LazyRethinkSession) IsConnected() bool

IsConnected returns true if session has a valid connection.

func (*LazyRethinkSession) Query

func (l *LazyRethinkSession) Query(ctx context.Context, q r.Query) (*r.Cursor, error)

Query executes a ReQL query using the session to connect to the database

Jump to

Keyboard shortcuts

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