db

package
v0.0.0-...-97177e4 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2018 License: GPL-3.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QueryDialect = cayleysql.QueryDialect{
	RegexpOp:   "REGEXP",
	FieldQuote: pq.QuoteIdentifier,
	Placeholder: func(n int) string {
		return fmt.Sprintf("$%d", n)
	},
}

Functions

This section is empty.

Types

type Conn

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

func (*Conn) Begin

func (c *Conn) Begin() (driver.Tx, error)

func (*Conn) BeginTx

func (c *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Exec

func (c *Conn) Exec(query string, args []driver.Value) (driver.Result, error)

func (*Conn) ExecContext

func (c *Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)

func (*Conn) Ping

func (c *Conn) Ping(ctx context.Context) error

func (*Conn) Prepare

func (c *Conn) Prepare(query string) (driver.Stmt, error)

func (*Conn) PrepareContext

func (c *Conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)

func (*Conn) Query

func (c *Conn) Query(query string, args []driver.Value) (driver.Rows, error)

func (*Conn) QueryContext

func (c *Conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error)

func (*Conn) SQLiteConn

func (c *Conn) SQLiteConn() *sqlite3.SQLiteConn

type Driver

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

Driver implements the driver.Conn interface by wrapping a SQLite3 driver with connections that use databases stored in Swarm.

func NewDriver

func NewDriver(name string, dpa *storage.DPA, registry registry.Registry, dir string) *Driver

NewDriver creates and registers a new database driver.

func (*Driver) Commit

func (d *Driver) Commit(name string) (common.Hash, error)

Commit commits the SQLite graph database with the given name by storing it in Swarm and returning the resulting Swarm hash.

func (*Driver) GraphRegistration

func (d *Driver) GraphRegistration() cayleysql.Registration

GraphRegistration returns a Cayley SQL registration which allows Cayley to use Swarm backed SQLite databases.

TODO: Update OpIsTrue to handle the fact that SQLite does not have

a built-in 'true' literal

TODO: Add a SQLite regex extension so that the REGEXP operator works

TODO: Update cayley so that it supports creating indexes in the

CREATE TABLE statement (currently we are just not creating
the indexes by setting NoForeignKeys)

func (*Driver) Open

func (d *Driver) Open(name string) (driver.Conn, error)

Open opens the SQLite graph database with the given name, wrapping it in a connection which is re-opened if the underlying graph is updated.

Jump to

Keyboard shortcuts

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