2014-05-04 05:53:38 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
_ "github.com/mattn/go-sqlite3"
|
2020-02-21 01:38:47 +00:00
|
|
|
"xorm.io/xorm"
|
2014-05-04 05:53:38 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
if len(os.Args) < 2 {
|
|
|
|
fmt.Println("need db path")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
orm, err := xorm.NewEngine("sqlite3", os.Args[1])
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
defer orm.Close()
|
2016-03-16 15:05:25 +00:00
|
|
|
orm.ShowSQL(true)
|
2014-05-04 05:53:38 +00:00
|
|
|
|
|
|
|
tables, err := orm.DBMetas()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, table := range tables {
|
|
|
|
fmt.Println(table.Name)
|
|
|
|
}
|
|
|
|
}
|