golang讀取sqllite結果集

        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
}

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章