database

package
v0.0.0-...-0379cd4 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2018 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConn

func NewConn() (*dbr.Connection, error)

NewConn tries to establish connection with database

Types

type Adapter

type Adapter interface {
	TxAdapter
	model.QueriesAdapter
}

func New

func New() (Adapter, error)

New connects and wraps connection into wrapper

type DB

type DB struct {
	*model.Queries
}

func (*DB) Begin

func (db *DB) Begin(sess *dbr.Session) (*dbr.Tx, error)

func (*DB) Commit

func (db *DB) Commit(tx *dbr.Tx) error

func (*DB) NewSession

func (db *DB) NewSession() *dbr.Session

func (*DB) Rollback

func (db *DB) Rollback(tx *dbr.Tx) error

type EventLogger

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

EventLogger is an implementation of the dbr.EventReceiver

func NewLogger

func NewLogger() *EventLogger

func (*EventLogger) Event

func (n *EventLogger) Event(eventName string)

Event receives a simple notification when various events occur

func (*EventLogger) EventErr

func (n *EventLogger) EventErr(eventName string, err error) error

EventErr receives a notification of an error if one occurs

func (*EventLogger) EventErrKv

func (n *EventLogger) EventErrKv(eventName string, err error, kvs map[string]string) error

EventErrKv receives a notification of an error if one occurs along with optional key/value data

func (*EventLogger) EventKv

func (n *EventLogger) EventKv(eventName string, kvs map[string]string)

EventKv receives a notification when various events occur along with optional key/value data

func (*EventLogger) Timing

func (n *EventLogger) Timing(eventName string, nanoseconds int64)

Timing receives the time an event took to happen

func (*EventLogger) TimingKv

func (n *EventLogger) TimingKv(eventName string, nanoseconds int64, kvs map[string]string)

TimingKv receives the time an event took to happen along with optional key/value data

type TxAdapter

type TxAdapter interface {
	NewSession() *dbr.Session

	Begin(sess *dbr.Session) (*dbr.Tx, error)
	Commit(tx *dbr.Tx) error
	Rollback(tx *dbr.Tx) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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