added blog example

This commit is contained in:
Pedro Nasser
2016-08-30 16:47:34 -03:00
parent b95e88bfdf
commit c9de0428aa
14 changed files with 597 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package database
import "gopkg.in/mgo.v2"
type Database struct {
Session *mgo.Session
}
func New(uri string) *Database {
session, err := mgo.Dial(uri)
if err != nil {
panic(err)
}
session.SetMode(mgo.Monotonic, true)
return &Database{
Session: session,
}
}