database

package module
Version: v0.0.0-...-066a3f7 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: NCSA Imports: 5 Imported by: 1

README

database

Database abstraction used by RAI and CarML

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultMaxConnections    = 30
	DefaultConnectionTimeout = 10 * time.Second
)

DefaultMaxConnections ...

Functions

This section is empty.

Types

type Database

type Database interface {
	Options() Options
	Session() interface{}
	Close() error
	String() string
}

Database ...

type DatabasePool

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

DatabasePool implements Database that uses pool of Database

func NewDatabasePool

func NewDatabasePool(impls ...Database) DatabasePool

NewDatabasePool takes several implementations of the Database and returns an instance of the Database that uses sync.Pool of given implemetations

func (DatabasePool) Close

func (_d DatabasePool) Close() (err error)

Close implements Database

func (DatabasePool) Options

func (_d DatabasePool) Options() (o1 Options)

Options implements Database

func (DatabasePool) Session

func (_d DatabasePool) Session() (p1 interface{})

Session implements Database

func (DatabasePool) String

func (_d DatabasePool) String() (s1 string)

String implements Database

type DatabaseWithRetry

type DatabaseWithRetry struct {
	Database
	// contains filtered or unexported fields
}

DatabaseWithRetry implements Database interface instrumented with retries

func NewDatabaseWithRetry

func NewDatabaseWithRetry(base Database, retryCount int, retryInterval time.Duration) DatabaseWithRetry

NewDatabaseWithRetry returns DatabaseWithRetry

func (DatabaseWithRetry) Close

func (_d DatabaseWithRetry) Close() (err error)

Close implements Database

type DatabaseWithTracing

type DatabaseWithTracing struct {
	Database
	// contains filtered or unexported fields
}

DatabaseWithTracing implements Database interface instrumented with opentracing spans

func NewDatabaseWithTracing

func NewDatabaseWithTracing(base Database, instance string) DatabaseWithTracing

NewDatabaseWithTracing returns DatabaseWithTracing

type Option

type Option func(*Options)

Option ...

func ConnectionTimeout

func ConnectionTimeout(t time.Duration) Option

ConnectionTimeout ...

func Endpoints

func Endpoints(addrs []string) Option

Endpoints ...

func MaxConnections

func MaxConnections(n int) Option

MaxConnections ...

func Password

func Password(s string) Option

Password ...

func TLSCertificate

func TLSCertificate(s string) Option

TLSCertificate ...

func TLSConfig

func TLSConfig(t *tls.Config) Option

TLSConfig ...

func Username

func Username(s string) Option

Username ...

func UsernamePassword

func UsernamePassword(u string, p string) Option

UsernamePassword ...

type Options

type Options struct {
	Endpoints         []string
	Username          string
	Password          string
	TLSConfig         *tls.Config
	MaxConnections    int
	ConnectionTimeout time.Duration
	Context           context.Context
}

Options ...

type Table

type Table interface {
	Name() string
	Create(e interface{}) error
	Delete() error
	Insert(elem interface{}) error
}

Table ...

type TablePool

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

TablePool implements Table that uses pool of Table

func NewTablePool

func NewTablePool(impls ...Table) TablePool

NewTablePool takes several implementations of the Table and returns an instance of the Table that uses sync.Pool of given implemetations

func (TablePool) Create

func (_d TablePool) Create(e interface{}) (err error)

Create implements Table

func (TablePool) Delete

func (_d TablePool) Delete() (err error)

Delete implements Table

func (TablePool) Insert

func (_d TablePool) Insert(elem interface{}) (err error)

Insert implements Table

func (TablePool) Name

func (_d TablePool) Name() (s1 string)

Name implements Table

type TableWithRetry

type TableWithRetry struct {
	Table
	// contains filtered or unexported fields
}

TableWithRetry implements Table interface instrumented with retries

func NewTableWithRetry

func NewTableWithRetry(base Table, retryCount int, retryInterval time.Duration) TableWithRetry

NewTableWithRetry returns TableWithRetry

func (TableWithRetry) Create

func (_d TableWithRetry) Create(e interface{}) (err error)

Create implements Table

func (TableWithRetry) Delete

func (_d TableWithRetry) Delete() (err error)

Delete implements Table

func (TableWithRetry) Insert

func (_d TableWithRetry) Insert(elem interface{}) (err error)

Insert implements Table

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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