From fbe0626a9d76e13f4752c0e087844bbe83d273cc Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 21 Mar 2016 12:07:48 -0700 Subject: [PATCH] common time tracking fields Signed-off-by: David Lawrence (github: endophage) --- storage/rethinkdb/rethinkdb.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/storage/rethinkdb/rethinkdb.go b/storage/rethinkdb/rethinkdb.go index 7e54e6e4c7..3c570be194 100644 --- a/storage/rethinkdb/rethinkdb.go +++ b/storage/rethinkdb/rethinkdb.go @@ -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) {