rmgo

package
v0.0.0-...-e87606f Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2014 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Global config
	Config *MongoConfig
	// Global mgo Session
	Session *mgo.Session
	// Global mgo Database
	Database *mgo.Database
	// Optimization: Stores the method to call in mgoSessionDupl so that it only
	// has to be looked up once (or whenever Session changes)
	Duplicate func() *mgo.Session
)

Functions

func Dial

func Dial() error

Main Dial func

func Init

func Init()

Types

type MongoConfig

type MongoConfig struct {
	Host   string
	Method string
	Db     string
}

type MongoController

type MongoController struct {
	*revel.Controller
	MongoSession *mgo.Session
}

func (*MongoController) Begin

func (m *MongoController) Begin() revel.Result

Connect to mgo if we haven't already and return a copy/new/clone of the session

func (*MongoController) End

func (m *MongoController) End() revel.Result

Close the controller session if we have an active one.

Jump to

Keyboard shortcuts

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