Documentation ¶
Index ¶
- Variables
- type Database
- type DatabasePool
- type DatabaseWithRetry
- type DatabaseWithTracing
- type Option
- func ConnectionTimeout(t time.Duration) Option
- func Endpoints(addrs []string) Option
- func MaxConnections(n int) Option
- func Password(s string) Option
- func TLSCertificate(s string) Option
- func TLSConfig(t *tls.Config) Option
- func Username(s string) Option
- func UsernamePassword(u string, p string) Option
- type Options
- type Table
- type TablePool
- type TableWithRetry
Constants ¶
This section is empty.
Variables ¶
var ( DefaultMaxConnections = 60 DefaultConnectionTimeout = 20 * time.Second )
DefaultMaxConnections ...
Functions ¶
This section is empty.
Types ¶
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) Options ¶
func (_d DatabasePool) Options() (o1 Options)
Options implements Database
func (DatabasePool) Session ¶
func (_d DatabasePool) Session() (p1 interface{})
Session 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 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 ¶
NewTablePool takes several implementations of the Table and returns an instance of the Table that uses sync.Pool of given implemetations
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