CovenantSQL: Index | Files

package storage

import ""

Package storage provides underlying storage implementation of CovenantSQL.


Package Files

doc.go dsn.go storage.go

type DSN Uses

type DSN struct {
    // contains filtered or unexported fields

DSN represents a sqlite connection string.

func NewDSN Uses

func NewDSN(s string) (*DSN, error)

NewDSN parses the given string and returns a DSN.

func (*DSN) AddParam Uses

func (dsn *DSN) AddParam(key, value string)

AddParam adds key:value pair DSN parameters.

func (*DSN) Clone Uses

func (dsn *DSN) Clone() (copy *DSN)

Clone returns a copy of current dsn.

func (*DSN) Format Uses

func (dsn *DSN) Format() string

Format formats DSN to a connection string.

func (*DSN) GetFileName Uses

func (dsn *DSN) GetFileName() string

GetFileName gets the sqlite database file name of DSN.

func (*DSN) GetParam Uses

func (dsn *DSN) GetParam(key string) (value string, ok bool)

GetParam gets the value.

func (*DSN) SetFileName Uses

func (dsn *DSN) SetFileName(fn string)

SetFileName sets the sqlite database file name of DSN.

type ExecLog Uses

type ExecLog struct {
    ConnectionID uint64
    SeqNo        uint64
    Timestamp    int64
    Queries      []Query

ExecLog represents the execution log of sqlite.

type ExecResult Uses

type ExecResult struct {
    LastInsertID int64
    RowsAffected int64

ExecResult represents the execution result of sqlite.

type Query Uses

type Query struct {
    Pattern string
    Args    []sql.NamedArg

Query represents the single query of sqlite.

type Storage Uses

type Storage struct {
    // contains filtered or unexported fields

Storage represents a underlying storage implementation based on sqlite3.

func New Uses

func New(dsn string) (st *Storage, err error)

New returns a new storage connected by dsn.

func (*Storage) Close Uses

func (s *Storage) Close() (err error)

Close implements database safe close feature.

func (*Storage) Commit Uses

func (s *Storage) Commit(ctx context.Context, wb twopc.WriteBatch) (result interface{}, err error)

Commit implements commit method of two-phase commit worker.

func (*Storage) Exec Uses

func (s *Storage) Exec(ctx context.Context, queries []Query) (result ExecResult, err error)

Exec implements write query feature.

func (*Storage) Prepare Uses

func (s *Storage) Prepare(ctx context.Context, wb twopc.WriteBatch) (err error)

Prepare implements prepare method of two-phase commit worker.

func (*Storage) Query Uses

func (s *Storage) Query(ctx context.Context, queries []Query) (columns []string, types []string,
    data [][]interface{}, err error)

Query implements read-only query feature.

func (*Storage) Rollback Uses

func (s *Storage) Rollback(ctx context.Context, wb twopc.WriteBatch) (err error)

Rollback implements rollback method of two-phase commit worker.

type TxID Uses

type TxID struct {
    ConnectionID uint64
    SeqNo        uint64
    Timestamp    int64

TxID represents a transaction ID.

Package storage imports 10 packages (graph) and is imported by 4 packages. Updated 2019-07-13. Refresh now. Tools for package owners.