Beispiel #1
0
func NewOrm(model interface{}) Orm {
	var err error
	self := Orm{Model: model}
	val := reflect.ValueOf(model)

	conn.Db = self.GetModel("DbName", val)
	conn.Col = self.GetModel("CollectionName", val)

	conn.InitDb()
	Sess = conn.Sess().Copy()

	Collection = Sess.DB(conn.Db).C(conn.Col)

	if err != nil {
		fmt.Println(err.Error())
	}
	return self
}
Beispiel #2
0
func (self *Orm) Close() {
	conn.Sess().Close()
}