database

package module
v0.0.0-...-ec9f9a4 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2014 License: MIT Imports: 17 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnimplemented     = errors.New("unimplemented")
	ErrInvalidAction     = errors.New("attempted to execute with an invalid action")
	ErrResourceForbidden = errors.New("resource forbidden")
)
View Source
var ErrUnexpectedMessageFormat = errors.New("unexpected message format")

Functions

func RegisterAction

func RegisterAction(a action.A, e NewExecutor) error

Types

type Database

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

func NewDatabase

func NewDatabase(mysqlDb *MysqlDatabase, filepath string) (*Database, error)

func (*Database) Begin

func (c *Database) Begin() (Transaction, error)

func (*Database) Execute

func (c *Database) Execute(A action.A) (interface{}, error)

func (*Database) Filepath

func (c *Database) Filepath() string

func (*Database) MysqlConn

func (c *Database) MysqlConn() MymysqlConn

func (*Database) MysqlDatabase

func (c *Database) MysqlDatabase() *MysqlDatabase

func (*Database) PrepareActions

func (c *Database) PrepareActions() (err error)

type DatabaseConn

type DatabaseConn interface {
	MysqlConn() MymysqlConn
	Filepath() string
	Begin() (Transaction, error)
}

type Db

type Db interface {
	Execute(action.A) (interface{}, error)
}

func New

func New(cfg config.Config) (Db, error)

type Err

type Err struct {
	Err error
}

func (Err) Error

func (e Err) Error() string

type Executor

type Executor interface {
	ExecuteWith(action.A) (interface{}, error)
}

type ExecutorRegistry

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

func NewExecutorRegistry

func NewExecutorRegistry() *ExecutorRegistry

func (*ExecutorRegistry) Lookup

func (r *ExecutorRegistry) Lookup(a action.A) NewExecutor

func (*ExecutorRegistry) Register

func (r *ExecutorRegistry) Register(a action.A, e NewExecutor) error

func (*ExecutorRegistry) RegisteredActions

func (r *ExecutorRegistry) RegisteredActions() []action.A

type MymysqlConn

type MymysqlConn interface {
	Connect() error

	Prepare(string) (mysql.Stmt, error)
	Begin() (mysql.Transaction, error)
}

A Subset of the mysql.Conn interface to specify exactly what functionality we use

type MysqlDatabase

type MysqlDatabase struct {
	mysql.Conn
	// contains filtered or unexported fields
}

func NewMysqlDatabase

func NewMysqlDatabase(basename string, c mysql.Conn) (*MysqlDatabase, error)

func NewUniqMysqlDatabase

func NewUniqMysqlDatabase(basename string, c mysql.Conn) (*MysqlDatabase, error)

func (*MysqlDatabase) Create

func (t *MysqlDatabase) Create() error

func (*MysqlDatabase) Drop

func (t *MysqlDatabase) Drop() error

func (*MysqlDatabase) Exists

func (t *MysqlDatabase) Exists() (bool, error)

func (*MysqlDatabase) GenerateSchema

func (t *MysqlDatabase) GenerateSchema() error

func (*MysqlDatabase) SetSchema

func (t *MysqlDatabase) SetSchema(schema string) error

type NewExecutor

type NewExecutor func(DatabaseConn) (Executor, error)

type RollbackError

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

func (RollbackError) Error

func (e RollbackError) Error() string

type Transaction

type Transaction interface {
	Commit() error
	Rollback() error
	Run(mysql.Stmt, ...interface{}) (mysql.Result, error)
	//SaveFiles([]datatype.FormFile) ([]string, error)
	SaveFile(datatype.FormFile) (string, error)
}

type UpdateResult

type UpdateResult struct {
	mysql.Result
}

func (*UpdateResult) MatchedRows

func (r *UpdateResult) MatchedRows() uint64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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