mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
21 lines
273 B
Go
21 lines
273 B
Go
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,
|
|
}
|
|
}
|