Documentation
¶
Index ¶
- Constants
- type Client
- type ClientOptionFunc
- func WithCACerts(certs []string) ClientOptionFunc
- func WithDatabase(db string) ClientOptionFunc
- func WithReadTimeout(timeout string) ClientOptionFunc
- func WithSSL(ssl bool) ClientOptionFunc
- func WithSessionTimeout(timeout string) ClientOptionFunc
- func WithURI(uri string) ClientOptionFunc
- func WithWriteTimeout(timeout string) ClientOptionFunc
- type Config
- type ConnectError
- type InvalidCertError
- type InvalidTimeoutError
- type InvalidURIError
- type Reader
- type RethinkDB
- type Session
- type VersionError
- type Writer
Constants ¶
const ( // DefaultURI is the default endpoint for RethinkDB on the local machine. // Primarily used when initializing a new Client without a specific URI. DefaultURI = "rethinkdb://127.0.0.1:28015/test" // DefaultTimeout is the default time.Duration used if one is not provided for options // that pertain to timeouts. DefaultTimeout = 10 * time.Second // DefaultDatabase used for the connection options DefaultDatabase = "test" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.2.0
type Client struct {
// contains filtered or unexported fields
}
Client creates and holds the session to RethinkDB
func NewClient ¶ added in v0.2.0
func NewClient(options ...ClientOptionFunc) (*Client, error)
NewClient creates a new client to work with RethinkDB.
The caller can configure the new client by passing configuration options to the func.
Example:
client, err := NewClient( WithURI("rethinkdb://localhost:28015"), WithTimeout("30s"))
If no URI is configured, it uses DefaultURI.
An error is also returned when some configuration option is invalid
type ClientOptionFunc ¶ added in v0.2.0
ClientOptionFunc is a function that configures a Client. It is used in NewClient.
func WithCACerts ¶ added in v0.2.0
func WithCACerts(certs []string) ClientOptionFunc
WithCACerts configures the RootCAs for the underlying TLS connection
func WithDatabase ¶ added in v0.2.0
func WithDatabase(db string) ClientOptionFunc
WithDatabase configures the database to use for the connection.
func WithReadTimeout ¶ added in v0.2.0
func WithReadTimeout(timeout string) ClientOptionFunc
WithReadTimeout overrides the DefaultTimeout and should be parseable by time.ParseDuration
func WithSSL ¶ added in v0.2.0
func WithSSL(ssl bool) ClientOptionFunc
WithSSL configures the database connection to connect via TLS.
func WithSessionTimeout ¶ added in v0.2.0
func WithSessionTimeout(timeout string) ClientOptionFunc
WithSessionTimeout overrides the DefaultTimeout and should be parseable by time.ParseDuration
func WithURI ¶ added in v0.2.0
func WithURI(uri string) ClientOptionFunc
WithURI defines the full connection string of the RethinkDB database.
func WithWriteTimeout ¶ added in v0.2.0
func WithWriteTimeout(timeout string) ClientOptionFunc
WithWriteTimeout overrides the DefaultTimeout and should be parseable by time.ParseDuration
type Config ¶
type Config struct { URI string `json:"uri" doc:"the uri to connect to, in the form rethink://user:password@host.example:28015/database"` Namespace string `json:"namespace" doc:"rethink namespace to read/write"` Timeout string `json:"timeout" doc:"timeout for establishing connection, format must be parsable by time.ParseDuration and defaults to 10s"` Tail bool `json:"tail" doc:"if true, the RethinkDB table will be monitored for changes after copying the namespace"` SSL bool `json:"ssl" doc:"enable TLS connection"` CACerts []string `json:"cacerts" doc:"array of root CAs to use in order to verify the server certificates"` }
Config provides custom configuration options for the RethinkDB adapter
type ConnectError ¶ added in v0.2.0
type ConnectError struct {
// contains filtered or unexported fields
}
ConnectError wraps the underlying error when a failure occurs dialing the database.
func (ConnectError) Error ¶ added in v0.2.0
func (e ConnectError) Error() string
type InvalidCertError ¶ added in v0.2.0
type InvalidCertError struct {
// contains filtered or unexported fields
}
InvalidCertError wraps the underlying error when the provided is certificate is not parsable.
func (InvalidCertError) Error ¶ added in v0.2.0
func (e InvalidCertError) Error() string
type InvalidTimeoutError ¶ added in v0.2.0
type InvalidTimeoutError struct {
// contains filtered or unexported fields
}
InvalidTimeoutError wraps the underlying error when the provided is not parsable time.ParseDuration.
func (InvalidTimeoutError) Error ¶ added in v0.2.0
func (e InvalidTimeoutError) Error() string
type InvalidURIError ¶ added in v0.2.0
type InvalidURIError struct {
// contains filtered or unexported fields
}
InvalidURIError wraps the underlying error when the provided URI is not parsable by mgo.
func (InvalidURIError) Error ¶ added in v0.2.0
func (e InvalidURIError) Error() string
type Reader ¶ added in v0.2.0
type Reader struct {
// contains filtered or unexported fields
}
Reader fulfills the client.Reader interface for use with both copying and tailing a RethinkDB database.
func (*Reader) Read ¶ added in v0.2.0
func (r *Reader) Read(filterFn client.NsFilterFunc) client.MessageChanFunc
type RethinkDB ¶
type RethinkDB struct {
// contains filtered or unexported fields
}
RethinkDB is an adaptor that writes metrics to rethinkdb (http://rethinkdb.com/) An open-source distributed database
func (*RethinkDB) Connect ¶
Connect tests the connection and if successful, connects to the database
func (*RethinkDB) Description ¶
Description for rethinkdb adaptor
func (*RethinkDB) SampleConfig ¶
SampleConfig for rethinkdb adaptor
type Session ¶ added in v0.2.0
type Session struct {
// contains filtered or unexported fields
}
Session contains an instance of the rethink.Session for use by Readers/Writers
type VersionError ¶ added in v0.2.0
type VersionError struct {
// contains filtered or unexported fields
}
VersionError represents any failure in attempting to obtain the version from the provided uri.
func (VersionError) Error ¶ added in v0.2.0
func (e VersionError) Error() string