config

package
v0.0.0-...-1dd2199 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2014 License: MIT Imports: 3 Imported by: 0

README

##config

Package config initializes variables of Db, Session, etc.

They should be specified by calling the Configure() function with a map[string]string as an argument.

For example,

package main

import (
	"fmt"

	"github.com/joshsoftware/curem/config"
)

func main() {
	c := make(map[string]string)
	c["name"] = "hello"
	c["url"] = "localhost"
	c["leads"] = "newlead"
	c["contacts"] = "newcontact"

	config.Configure(c)

	fmt.Printf("%+v\n", config.Db)
	fmt.Printf("%+v\n", config.Session)
	fmt.Printf("%+v\n", config.LeadsCollection)
	fmt.Printf("%+v\n", config.ContactsCollection)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Session is the configured MongoDB Session
	Session *mgo.Session

	// Db is the configured database
	Db *mgo.Database

	// LeadsCollection is the collection storing leads
	LeadsCollection *mgo.Collection

	// ContactsCollection is the collection storing contacts
	ContactsCollection *mgo.Collection

	// ContactsCollectionName is the name of the collection containing contacts.
	// It is required for forming the DB Query while performing text search.
	ContactsCollectionName string
)

Functions

func Configure

func Configure(options map[string]string)

Configure configures the options, sets up the database, initializes exported session, database and collection variables.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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