コード例 #1
0
func SetupDb() (q *qbs.Qbs) {
	var (
		err       error
		migration *qbs.Migration
	)

	q, err = qbs.GetQbs()

	if q, err = qbs.GetQbs(); err != nil {
		panic(err)
	}

	if migration, err = qbs.GetMigration(); err != nil {
		panic(err)
	}
	defer migration.Close()

	if err = migration.CreateTableIfNotExists(new(User)); err != nil {
		panic(err)
	}

	if err = migration.CreateTableIfNotExists(new(Profile)); err != nil {
		panic(err)
	}

	return q
}
コード例 #2
0
func SetupDb() (q *qbs.Qbs) {
	var (
		err       error
		migration *qbs.Migration
	)

	qbs.SetLogger(log.New(os.Stdout, "query:", log.Lmicroseconds), log.New(os.Stdout, "error:", log.Lmicroseconds))

	q, err = qbs.GetQbs()

	if q, err = qbs.GetQbs(); err != nil {
		panic(err)
	}

	if migration, err = qbs.GetMigration(); err != nil {
		panic(err)
	}
	defer migration.Close()
	if err = migration.CreateTableIfNotExists(new(User)); err != nil {
		panic(err)
	}

	return q
}