common time tracking fields

Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
This commit is contained in:
David Lawrence 2016-03-21 12:07:48 -07:00 committed by Riyaz Faizullabhoy
parent 860714c9d3
commit fbe0626a9d
1 changed files with 10 additions and 0 deletions

View File

@ -1,12 +1,22 @@
package rethinkdb
import (
"time"
"github.com/dancannon/gorethink"
"github.com/docker/go-connections/tlsconfig"
)
var session *gorethink.Session
// Timing can be embedded into other gorethink models to
// add time tracking fields
type Timing struct {
CreatedAt *time.Time `gorethink:"created_at"`
UpdatedAt *time.Time `gorethink:"updated_at"`
DeletedAt *time.Time `gorethink:"deleted_at"`
}
// Connection sets up a RethinkDB connection to the host (`host:port` format)
// using the CA .pem file provided at path `caFile` and the authKey
func Connection(caFile, host, authKey string) (*gorethink.Session, error) {