mirror of
https://github.com/araxiaonline/wow-item-generator.git
synced 2026-06-13 03:02:22 -04:00
34 lines
460 B
Go
34 lines
460 B
Go
package sqlite
|
|
|
|
import (
|
|
"github.com/jmoiron/sqlx"
|
|
|
|
_ "github.com/mattn/go-sqlite3"
|
|
)
|
|
|
|
type SqlLite struct {
|
|
*sqlx.DB
|
|
}
|
|
|
|
var SqlLiteDb *SqlLite
|
|
|
|
func Connect(path string) (*SqlLite, error) {
|
|
client, err := sqlx.Open("sqlite3", path)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
SqlLiteDb = &SqlLite{client}
|
|
return SqlLiteDb, nil
|
|
}
|
|
|
|
func GetDb() (*SqlLite, error) {
|
|
return SqlLiteDb, nil
|
|
}
|
|
|
|
func (db *SqlLite) Close() {
|
|
if db.DB != nil {
|
|
db.DB.Close()
|
|
}
|
|
}
|