package rethinkdb

import "github.com/theupdateframework/notary/storage/rethinkdb"

Index

Functions

func AdminConnection

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

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

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 corresponding 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

Source Files

bootstrap.go rethinkdb.go

Version
v0.7.0 (latest)
Published
Jan 14, 2021
Platform
linux/amd64
Imports
6 packages
Last checked
2 hours ago

Tools for package owners.