pgdoc

package
v0.0.0-...-82c1157 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2014 License: BSD-3-Clause, BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

pgdoc wraps a postgresql database into a simple document database using the json column

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIndexAlreadyExists = errors.New("index already exists on database")
)

Functions

This section is empty.

Types

type Database

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

func OpenDatabase

func OpenDatabase(user, password, database, host string) (*Database, error)

func (*Database) Close

func (d *Database) Close() error

func (*Database) CreateIndex

func (d *Database) CreateIndex(tableOrLink string, idxName string, propPath ...string) error

func (*Database) DropIndex

func (d *Database) DropIndex(tableOrLink string, idxName string) error
func (d *Database) Link(name string) (*Link, error)

func (*Database) Table

func (d *Database) Table(name string) (*Table, error)

func (*Database) Truncate

func (d *Database) Truncate(tblOrLink string) error

Truncate remove all data from the given table or link and all related foreign keys (if any)

func (*Database) Unique

func (d *Database) Unique(tableOrLink string, idxName string, propPath ...string) error

type Iterator

type Iterator interface {
	// Move the iterator to the next value.
	//
	// IMPORTANT! The iterator starts behind the first value, ie,
	// before reading the first value you MUST CALL Next.
	//
	// When Next returns false this could mean that no more data
	// is available or an error happend. Call Err() to distinguish
	// between the cases.
	//
	// When Next returns false, Close is called so, iterating using
	// for it.Next() { /* ... */ } will close this iterator, as long
	// the for body don't panic.
	//
	// You can call Close multiple times without any problem.
	Next() bool
	// Scan the next value into out
	Scan(out interface{}) error
	// Return the last error found when calling Scan or ErrClosed,
	// if we don't have more data
	Err() error
	// Close this iterator and return any error, errors that happend
	// while calling Scan aren't returned here.
	//
	// Calls to Close are idempotent
	Close() error
}
type Link struct {
	// contains filtered or unexported fields
}

func (*Link) Connect

func (l *Link) Connect(val interface{}) (string, error)

Save will put the given object in the table.

func (*Link) From

func (l *Link) From(from string) Iterator

func (*Link) Label

func (l *Link) Label(label string) Iterator

func (*Link) Load

func (l *Link) Load(out interface{}, id string) error

func (*Link) LoadMany

func (l *Link) LoadMany(from, to, label string) Iterator

func (*Link) Name

func (l *Link) Name() string

func (*Link) To

func (l *Link) To(to string) Iterator

type Table

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

func (*Table) Load

func (t *Table) Load(out interface{}, id string) error

func (*Table) Name

func (t *Table) Name() string

func (*Table) Save

func (t *Table) Save(val interface{}) (string, error)

Save will put the given object in the table.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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