<commit_before>package qb

import (
	"database/sql"
	_ "github.com/mattn/go-sqlite3"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/suite"
	"testing"
	"time"
)

type SqliteTestSuite struct {
	suite.Suite
	engine   *Engine
	metadata *MetaDataElem
}

func (suite *SqliteTestSuite) SetupTest() {
	var err error

	suite.engine, err = New("sqlite3", "./qb_test.db")
	suite.engine.Logger().SetLogFlags(LQuery | LBindings)
	suite.engine.Dialect().SetEscaping(true)

	suite.metadata = MetaData()

	assert.Nil(suite.T(), err)
	assert.NotNil(suite.T(), suite.engine)
}

func (suite *SqliteTestSuite) TestUUID() {
	assert.Equal(suite.T(), "VARCHAR(36)", suite.engine.Dialect().CompileType(UUID()))
}

func (suite *SqliteTestSuite) TestSqlite() {
	type User struct {
		ID       string         `db:"id"`
		Email    string         `db:"email"`
		FullName string         `db:"full_name"`
		Bio      sql.NullString `db:"bio"`
		Oscars   int            `db:"oscars"`
	}

	type Session struct {
		UserID    string    `db:"user_id"`
		AuthToken string    `db:"auth_token"`
		CreatedAt time.Time `db:"created_at"`
		ExpiresAt time.Time `db:"expires_at"`
	}

	users := Table(
		"users",<commit_msg>Disable sql logging in sqlite tests<commit_after>package qb

import (
	"database/sql"
	_ "github.com/mattn/go-sqlite3"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/suite"
	"testing"
	"time"
)

type SqliteTestSuite struct {
	suite.Suite
	engine   *Engine
	metadata *MetaDataElem
}

func (suite *SqliteTestSuite) SetupTest() {
	var err error

	suite.engine, err = New("sqlite3", "./qb_test.db")
	suite.engine.Dialect().SetEscaping(true)

	suite.metadata = MetaData()

	assert.Nil(suite.T(), err)
	assert.NotNil(suite.T(), suite.engine)
}

func (suite *SqliteTestSuite) TestUUID() {
	assert.Equal(suite.T(), "VARCHAR(36)", suite.engine.Dialect().CompileType(UUID()))
}

func (suite *SqliteTestSuite) TestSqlite() {
	type User struct {
		ID       string         `db:"id"`
		Email    string         `db:"email"`
		FullName string         `db:"full_name"`
		Bio      sql.NullString `db:"bio"`
		Oscars   int            `db:"oscars"`
	}

	type Session struct {
		UserID    string    `db:"user_id"`
		AuthToken string    `db:"auth_token"`
		CreatedAt time.Time `db:"created_at"`
		ExpiresAt time.Time `db:"expires_at"`
	}

	users := Table(
		"users",
{'fraction_non_alphanumeric': 0.14980956411341514, 'fraction_numerical': 0.0033855268726195515, 'mean_word_length': 3.6811881188118813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4773727', 'n_tokens_mistral': 896, 'n_tokens_neox': 866, 'n_words': 170}