golang使用mgo操作mongoDB遇到奇葩问题,求教
1个回答
展开全部
package main
import (
"fmt"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
type DB struct {
Session *mgo.Session
Collection *mgo.Collection
}
type Digapp struct {
App_id string
Fetch_url string
From string //
Fetch_state bool
Fetch_priority int32 //
Create_time int64 //
Invalid bool // + app is access now ?
}
func main() {
db := new(DB)
if err := db.DBInit(); err != nil {
fmt.Println("初始化数据库失败!错误为:" + err.Error())
return
}
defer db.Close()
var digapp Digapp
//{"fetch_priority": 5, "
import (
"fmt"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
type DB struct {
Session *mgo.Session
Collection *mgo.Collection
}
type Digapp struct {
App_id string
Fetch_url string
From string //
Fetch_state bool
Fetch_priority int32 //
Create_time int64 //
Invalid bool // + app is access now ?
}
func main() {
db := new(DB)
if err := db.DBInit(); err != nil {
fmt.Println("初始化数据库失败!错误为:" + err.Error())
return
}
defer db.Close()
var digapp Digapp
//{"fetch_priority": 5, "
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询