cockroachdb

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2019 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cockroachdb contains an implementation of the `gokv.Store` interface for CockroachDB.

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = Options{
	ConnectionURL:      "postgres://root@localhost:26257/" + defaultDBname + "?sslmode=disable&application_name=gokv",
	TableName:          "Item",
	MaxOpenConnections: 100,
	Codec:              encoding.JSON,
}

DefaultOptions is an Options object with default values. ConnectionURL: "postgres://root@localhost:26257/gokv?sslmode=disable&application_name=gokv", TableName: "Item", MaxOpenConnections: 100, Codec: encoding.JSON

Functions

This section is empty.

Types

type Client

type Client struct {
	*sql.Client
}

Client is a gokv.Store implementation for CockroachDB.

func NewClient

func NewClient(options Options) (Client, error)

NewClient creates a new CockroachDB client.

You must call the Close() method on the client when you're done working with it.

type Options

type Options struct {
	// Connection URL.
	// Format: postgres://username[:password]@address/dbname[?param1=value1&...&paramN=valueN].
	// Example: "postgres://roach:secret@localhost:26257/gokv?sslmode=disable".
	// The database ("dbname" in the example) must already exist.
	// For a full list of available connection parameters, see:
	// https://github.com/cockroachdb/docs/blob/560c4227f4d811c5be9dc8e4a5385e508d0c68e5/v2.1/connection-parameters.md#additional-connection-parameters.
	// Optional ("postgres://root@localhost:26257/gokv?sslmode=disable&application_name=gokv" by default,
	// which will connect to "localhost:26257" as root user and doesn't use TLS,
	// which you should NOT do in production).
	ConnectionURL string
	// Name of the table in which the key-value pairs are stored.
	// Optional ("Item" by default).
	TableName string
	// Limits the number of open connections to the CockroachDB server.
	// -1 for no limit. 0 will lead to the default value (100) being set.
	// Optional (100 by default).
	MaxOpenConnections int
	// Encoding format.
	// Optional (encoding.JSON by default).
	Codec encoding.Codec
}

Options are the options for the CockroachDB client.

Jump to

Keyboard shortcuts

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