db

package
v0.0.0-...-c8feaad Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectRethinkDB

func ConnectRethinkDB(opts map[string]interface{}) (*r.Session, error)

ConnectRethinkDB connects to a rethinkdb database

func DeleteRethinkDBDocument

func DeleteRethinkDBDocument(key string, table r.Term, session *r.Session) error

DeleteRethinkDBDocument will delete the document with the given ID from rethinkdb

func GetRethinkDBAllDocuments

func GetRethinkDBAllDocuments(model interface{}, table r.Term, session *r.Session) error

GetRethinkDBAllDocuments will get all documents from the given rethinkdb table

func GetRethinkDBDocument

func GetRethinkDBDocument(key string, model interface{}, table r.Term, session *r.Session) error

GetRethinkDBDocument will get the document with the given ID from rethinkdb

func InsertRethinkDBDocument

func InsertRethinkDBDocument(doc interface{}, model interface{}, table r.Term, session *r.Session) error

InsertRethinkDBDocument will insert the given document in rethinkdb

func UpdateRethinkDBDocument

func UpdateRethinkDBDocument(id string, doc interface{}, model interface{}, table r.Term, session *r.Session) error

UpdateRethinkDBDocument will update the given document in rethinkdb

Types

type Collection

type Collection struct {
	Datastore string
	Name      string
}

Collection represents a named group of documents in the datastore.

type Datastore

type Datastore interface {
	CreateDoc(*Document) (*Document, error)
	DeleteDoc(*Document) error
	GetAllDocs(*Collection) ([]Document, error)
	GetDoc(string, *Collection) (*Document, error)
	UpdateDoc(*Document) (*Document, error)
}

Datastore interface abstracts the underlying storage implementation.

type Document

type Document struct {
	Collection Collection
	Content    interface{}
}

Document represents a "record" in the datastore.

Jump to

Keyboard shortcuts

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