package main

import (
	"fmt"
	"github.com/go-xorm/core"
	"github.com/go-xorm/xorm"
	_ "github.com/mattn/go-sqlite3"
)

var db *xorm.Engine

func DBinit() *xorm.Engine {
	SiteConf := initConfig()
	db, err := xorm.NewEngine("sqlite3", SiteConf.DBFile)
	if err != nil {
		fmt.Println(err)
	}

	db.SetMapper(core.SameMapper{})
	db.ShowSQL(false)
	db.Logger().SetLevel(core.LOG_DEBUG)
	return db
}
