db

package
Version: v0.0.0-...-cc4d7bc Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2013 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

This module configures a database connection for the application.

Developers use this module by importing and calling db.Init(). A "Transactional" controller type is provided as a way to import interceptors that manage the transaction

In particular, a transaction is begun before each request and committed on success. If a panic occurred during the request, the transaction is rolled back. (The application may also roll the transaction back itself.)

Index

Constants

This section is empty.

Variables

View Source
var (
	Db     *sql.DB
	Driver string
	Spec   string
)

Functions

func Init

func Init()

Types

type Transactional

type Transactional struct {
	*revel.Controller
	Txn *sql.Tx
}

func (*Transactional) Begin

func (c *Transactional) Begin() revel.Result

Begin a transaction

func (*Transactional) Commit

func (c *Transactional) Commit() revel.Result

Commit the transaction.

func (*Transactional) Rollback

func (c *Transactional) Rollback() revel.Result

Rollback if it's still going (must have panicked).

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL