databasehandler

package
v0.0.0-...-b99263a Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NoSqlDB

type NoSqlDB struct {
	DB *kivik.DB
}

NoSqlDB is the concrete implementation of NoSqlGdbc

func (*NoSqlDB) AllDocs

func (nsdb *NoSqlDB) AllDocs(ctx context.Context, options ...kivik.Options) (*kivik.Rows, error)

func (*NoSqlDB) Exec

func (nsdb *NoSqlDB) Exec(query string, args ...interface{}) (sql.Result, error)

the followings are dummy implementation for SqlGdbc After implementing the following, NoSqlDB will also implements SqlGdbc interface. This making the courseDataServieFactory possible. The functions will never be called, it just makes the interface available If you don't need something similar to courseDataServiceFactory, you can remove the following code.

func (*NoSqlDB) Find

func (nsdb *NoSqlDB) Find(ctx context.Context, query interface{}) (*kivik.Rows, error)

func (*NoSqlDB) Get

func (nsdb *NoSqlDB) Get(ctx context.Context, docID string, options ...kivik.Options) (*kivik.Row, error)

func (*NoSqlDB) Prepare

func (nsdb *NoSqlDB) Prepare(query string) (*sql.Stmt, error)

func (*NoSqlDB) Put

func (nsdb *NoSqlDB) Put(ctx context.Context, docID string, doc interface{}, options ...kivik.Options) (rev string, err error)

func (*NoSqlDB) Query

func (nsdb *NoSqlDB) Query(query string, args ...interface{}) (*sql.Rows, error)

func (*NoSqlDB) QueryNoSql

func (nsdb *NoSqlDB) QueryNoSql(ctx context.Context, ddoc string, view string) (*kivik.Rows, error)

func (*NoSqlDB) QueryRow

func (nsdb *NoSqlDB) QueryRow(query string, args ...interface{}) *sql.Row

type SqlConnTx

type SqlConnTx struct {
	DB *sql.Tx
}

SqlConnTx is the concrete implementation of sqlGdbc by using *sql.Tx

func (*SqlConnTx) Commit

func (sct *SqlConnTx) Commit() error

func (*SqlConnTx) Exec

func (sdb *SqlConnTx) Exec(query string, args ...interface{}) (sql.Result, error)

func (*SqlConnTx) Prepare

func (sdb *SqlConnTx) Prepare(query string) (*sql.Stmt, error)

func (*SqlConnTx) Query

func (sdb *SqlConnTx) Query(query string, args ...interface{}) (*sql.Rows, error)

func (*SqlConnTx) QueryRow

func (sdb *SqlConnTx) QueryRow(query string, args ...interface{}) *sql.Row

func (*SqlConnTx) Rollback

func (sct *SqlConnTx) Rollback() error

func (*SqlConnTx) TxBegin

func (sct *SqlConnTx) TxBegin() (gdbc.SqlGdbc, error)

*sql.Tx can't begin a transaction, transaction always begins with a *sql.DB

func (*SqlConnTx) TxEnd

func (sct *SqlConnTx) TxEnd(txFunc func() error) error

type SqlDBTx

type SqlDBTx struct {
	DB *sql.DB
}

SqlDBTx is the concrete implementation of sqlGdbc by using *sql.DB

func (*SqlDBTx) AllDocs

func (sdt *SqlDBTx) AllDocs(ctx context.Context, options ...kivik.Options) (*kivik.Rows, error)

func (*SqlDBTx) Commit

func (cdt *SqlDBTx) Commit() error

DB doesnt commit, do nothing here

func (*SqlDBTx) Exec

func (sdt *SqlDBTx) Exec(query string, args ...interface{}) (sql.Result, error)

func (*SqlDBTx) Find

func (sdt *SqlDBTx) Find(ctx context.Context, query interface{}) (*kivik.Rows, error)

func (*SqlDBTx) Get

func (sdt *SqlDBTx) Get(ctx context.Context, docID string, options ...kivik.Options) (*kivik.Row, error)

func (*SqlDBTx) Prepare

func (sdt *SqlDBTx) Prepare(query string) (*sql.Stmt, error)

func (*SqlDBTx) Put

func (sdt *SqlDBTx) Put(ctx context.Context, docID string, doc interface{}, options ...kivik.Options) (rev string, err error)

func (*SqlDBTx) Query

func (sdt *SqlDBTx) Query(query string, args ...interface{}) (*sql.Rows, error)

func (*SqlDBTx) QueryNoSql

func (sdt *SqlDBTx) QueryNoSql(ctx context.Context, ddoc string, view string) (*kivik.Rows, error)

The followings are dummy implementation for noSqlGdbc. After implementing the following, SqlDBTx will also implements NoSqlGdbc interface. This making the courseDataServiceFactory possible. The functions will never be called, it just makes the interface available If you don't need something similar to courseDataServiceFactory, you can remove the following code.

func (*SqlDBTx) QueryRow

func (sdt *SqlDBTx) QueryRow(query string, args ...interface{}) *sql.Row

func (*SqlDBTx) Rollback

func (cdt *SqlDBTx) Rollback() error

DB doesn't rollback, do nothing here

func (*SqlDBTx) TxBegin

func (sdt *SqlDBTx) TxBegin() (gdbc.SqlGdbc, error)

TransactionBegin starts a transaction

func (*SqlDBTx) TxEnd

func (cdt *SqlDBTx) TxEnd(txFunc func() error) error

DB doesnt rollback, do nothing here

Jump to

Keyboard shortcuts

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