boat

package module
v0.0.0-...-63416ba Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

README

Gopher on a boat

Documentation

Index

Constants

View Source
const MASTER = -1

Variables

View Source
var DB *sql.DB

Functions

func AtomicRequest

func AtomicRequest(h http.Handler) http.Handler

func Bootstrap

func Bootstrap(db *sql.DB) error

It must return error or panics as all other?..

func Check

func Check(err error)

func Delete

func Delete(docId int, collection string, tx *sql.Tx)

func DropTenant

func DropTenant(tenantId int, tx *sql.Tx)

func EnsureCollection

func EnsureCollection(name string, tx *sql.Tx)

EnsureCollection checks existance of a collection and creates it, if it is not exist.

func EnsureGINIndex

func EnsureGINIndex(tableName string, tx *sql.Tx)

EnsureGINIndex checks existance of a GIN index on doc fileld for table tableName and creates it, if it is not exist.

func EnsureSchema

func EnsureSchema(name string, tx *sql.Tx)

EnsureSchema checks existance of a schema and creates it, if it is not exist.

func EnsureTenant

func EnsureTenant(tenant *Tenant, tenantInit func(tx *sql.Tx), tx *sql.Tx)

func Find

func Find(docId int, collection string, doc interface{}, tx *sql.Tx) (found bool)

func FindTenantByName

func FindTenantByName(tenantName string, tenant *Tenant, tx *sql.Tx) (tenantId int, found bool)

func GetTx

func GetTx(r *http.Request) *sql.Tx

func Insert

func Insert(doc interface{}, collection string, tx *sql.Tx) (docId int)

func Open

func Open(connectionURL string) (*sql.DB, error)

connectionURL like "postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full" Boat uses Postgres only.

func Update

func Update(doc interface{}, docId int, collection string, tx *sql.Tx)

func Use

func Use(tenantId int, tx *sql.Tx)

func UseMaster

func UseMaster(h http.Handler) http.Handler

func UseTenantBySubdomain

func UseTenantBySubdomain(h http.Handler) http.Handler

Types

type Rows

type Rows struct {
	// contains filtered or unexported fields
}

Make our Rows with a blackjack

func Select

func Select(collection string, tx *sql.Tx, where string, params ...interface{}) (rows Rows)

func (*Rows) Close

func (r *Rows) Close()

func (*Rows) Next

func (r *Rows) Next() bool

func (*Rows) Scan

func (r *Rows) Scan(docId *int, doc interface{})

type Tenant

type Tenant struct {
	Name   string
	Active bool
	Aux    interface{} // For any useful auxilary data.
}

Tenant is data struct for doc in master table.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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