StoragePath := "2"
count, err := Gettxt(StoragePath)//從數據庫取 字段 裏面的數值
if err != nil {
beego.Error(err)
}
fmt.Println("====",count)
//上面的在一個放需要執行的方法裏面就ok
func Gettxt( StoragePath string) (int64, error) {//獲取文件名稱 是否存在
db := orm.NewOrm()
var count int64
err := db.Raw("select count(filename) FROM historytxttwo where filename = "+"'"+StoragePath+"'"+" ").QueryRow(&count)
return count, err
}