db

package
v0.0.0-...-41b0918 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2014 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDb

func WithDb(spec Spec, f Action) (interface{}, error)

WithDb - execute the action using the current db

func WithTransaction

func WithTransaction(spec Spec, f Write) (interface{}, error)

WithTransaction Execute the given function with a new transaction, committing afterwards.

Types

type Action

type Action func(db *sqlx.DB) (interface{}, error)

Action - read operation

type Spec

type Spec struct {
	DBType     string
	Properties []specProperty
}

Spec - wrapper for DB connection parameters. DBType should be one of the types supported by database/sql

func LoadSpec

func LoadSpec(f string) Spec

LoadSpec - load the db specification from the given file

type Write

type Write func(db *sqlx.Tx) (interface{}, error)

Write function to be wrapped in db connection

Jump to

Keyboard shortcuts

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