package rethinkdb
import "github.com/theupdateframework/notary/storage/rethinkdb"
Index ¶
- func AdminConnection(tlsOpts tlsconfig.Options, host string) (*gorethink.Session, error)
- func CreateAndGrantDBUser(session *gorethink.Session, dbName, username, password string) error
- func SetupDB(session *gorethink.Session, dbName string, tables []Table) error
- func UserConnection(tlsOpts tlsconfig.Options, host, username, password string) (*gorethink.Session, error)
- type Table
- type Timing
Functions ¶
func AdminConnection ¶
AdminConnection sets up an admin RethinkDB connection to the host (`host:port` format) using the CA .pem file provided at path `caFile`
func CreateAndGrantDBUser ¶
CreateAndGrantDBUser handles creating a rethink user and granting it permissions to the provided db.
func SetupDB ¶
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 ¶
- Version
- v0.7.0 (latest)
- Published
- Jan 14, 2021
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 8 months ago –
Tools for package owners.