rethinkdb

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminConnection added in v0.4.0

func AdminConnection(tlsOpts tlsconfig.Options, host string) (*gorethink.Session, error)

AdminConnection sets up an admin RethinkDB connection to the host (`host:port` format) using the CA .pem file provided at path `caFile`

func CreateAndGrantDBUser added in v0.4.0

func CreateAndGrantDBUser(session *gorethink.Session, dbName, username, password string) error

CreateAndGrantDBUser handles creating a rethink user and granting it permissions to the provided db.

func SetupDB

func SetupDB(session *gorethink.Session, dbName string, tables []Table) error

SetupDB handles creating the database and creating all tables and indexes.

func UserConnection added in v0.4.0

func UserConnection(tlsOpts tlsconfig.Options, host, username, password string) (*gorethink.Session, error)

UserConnection sets up a user RethinkDB connection to the host (`host:port` format) using the CA .pem file provided at path `caFile`, using the provided username.

Types

type Table

type Table struct {
	Name       string
	PrimaryKey interface{}
	// Keys are the index names. If len(value) is 0, it is a simple index
	// on the field matching the key. Otherwise, it is a compound index
	// on the list of fields in the corrensponding slice value.
	SecondaryIndexes map[string][]string
	Config           map[string]string
	//JSONUnmarshaller takes a byte slice representing JSON data and knows how
	//to unmarshal them into a model representing this table
	JSONUnmarshaller func([]byte) (interface{}, error)
}

Table holds the configuration for setting up a RethinkDB table

type Timing

type Timing struct {
	CreatedAt time.Time `gorethink:"created_at"`
	UpdatedAt time.Time `gorethink:"updated_at"`
	DeletedAt time.Time `gorethink:"deleted_at"`
}

Timing can be embedded into other gorethink models to add time tracking fields

Jump to

Keyboard shortcuts

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