mirror of
https://github.com/zhufuyi/sponge.git
synced 2025-10-06 01:07:08 +08:00
style: move the initialization database code to internal/database and add the sgorm library
This commit is contained in:
@@ -4,16 +4,16 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/zhufuyi/sponge/pkg/ggorm"
|
||||
"github.com/zhufuyi/sponge/pkg/sgorm/sqlite"
|
||||
)
|
||||
|
||||
// GetSqliteTableInfo get table info from sqlite
|
||||
func GetSqliteTableInfo(dbFile string, tableName string) (string, error) {
|
||||
db, err := ggorm.InitSqlite(dbFile)
|
||||
db, err := sqlite.Init(dbFile)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer closeDB(db)
|
||||
defer sqlite.Close(db) //nolint
|
||||
|
||||
var sqliteFields SqliteFields
|
||||
sql := fmt.Sprintf("PRAGMA table_info('%s')", tableName)
|
||||
|
Reference in New Issue
Block a user