package
1.3.1
Repository: https://github.com/kumparan/go-lib.git
Documentation: pkg.go.dev

# README

SQLImporter

SQLImporter is not a database migration tools. This is tools is for importing and executing sql files into test database.

This works is inspired By Hendra Huang database integration test: https://github.com/Hendra-Huang/databaseintegrationtest.

What is this for?

To test integration with database. When we have a function that interract with database, the schema is imported and can be dropped afterwards.

Sql file for SQLImporter

To differentiate each queries in sql files, --end need to be added.

CREATE TABLE IF NOT EXISTS `something1` (
    `something1_id` bigint(20) NOT NULL
)
--end

CREATE TABLE IF NOT EXISTS `something2` (
    `something2_id` bigint(20) NOT NULL,
    `field1` varchar(10) NOT NULL
)
--end

# Packages

No description provided by the author

# Functions

Connect to database.
CreateDB used to create database and import all queries located in a directories.
CreateRandomDB for creating a database name/schema for test.
ImportSchemaFromFiles to import all *.sql file from directory.

# Constants

DBNameDefault default database name for sqlimporter.