database

package
v0.0.0-...-547b272 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2018 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound   = errors.New("not found row")
	ErrDuplicated = errors.New("duplicated row")
)

Functions

This section is empty.

Types

type DeadlockError

type DeadlockError interface {
	IsDeadlock() bool
}

type DuplicatedError

type DuplicatedError interface {
	IsDuplicated() bool
}

type LockMode

type LockMode int
const (
	LockNone LockMode = iota
	LockRead
	LockWrite
)

type NotFoundError

type NotFoundError interface {
	IsNotFound() bool
}

type Queryer

type Queryer interface {
	Query(func(*sql.Tx) error) error
}

type Transaction

type Transaction interface {
	Queryer
	// Begin starts this transactoin. Begin should start a new fresh transaction if it
	// is called on an already finished (committed or rollbacked) transaction.
	Begin() error
	Commit() error
	Rollback() error
	// Error returns the last TransactionError, if any, that was encountered during
	// query and commit processes.
	Error() TransactionError
}

Transaction provides a database transaction. Transaction should return TransactionError when an error occurs.

type TransactionError

type TransactionError interface {
	error
	DeadlockError
	NotFoundError
	DuplicatedError
}

type TransactionManager

type TransactionManager interface {
	NewTransaction() Transaction
}

Directories

Path Synopsis
eas

Jump to

Keyboard shortcuts

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