Documentation ¶
Overview ¶
Package create has functions to create an SQLite3 database from a zipped CSV file.
Index ¶
- Variables
- func CreateDDL() string
- func CreateDatabase(zipFileName, entryName, dbFileName string, progressEvery int) error
- func CreateInsertSQL(cols []string) string
- func CreatePreparedStatement(tx *sql.Tx) (*sql.Stmt, error)
- func GetSelectedIndices(columns, selectedCols []string) []int
- func GetZipEntry(zipFileName string, entryName string) (*zip.File, error)
- func IsSanitizeCol(colName string) bool
- func Sanitize(input string) string
Constants ¶
This section is empty.
Variables ¶
var (
MAX_ENTRIES int
)
Functions ¶
func CreateDDL ¶
func CreateDDL() string
This function creates a Data Definition Language (DDL) statement for creating a table called `voters`.
func CreateDatabase ¶
CreateDatabase is the mainline for creating a database from the zip file.
func CreateInsertSQL ¶
CreateInsertSQL creates an SQL string that can be used for inserting records into the voters table.
func CreatePreparedStatement ¶
CreatePreparedStatement creates an SQL statement for inserting records into the voters table.
func GetSelectedIndices ¶
GetSelectedIndices returns the indices of selected columns from a given list of columns.
It takes two parameters:
- 'columns' a slice of strings representing all available columns, and
- 'selectedCols' - a slice of strings representing the columns that are selected.
The function iterates over the 'columns' slice, checks if each column exists in the 'selectedCols' slice, and if found, appends the index of the column to the 'selectedIndices' slice. Finally, it returns the 'selectedIndices' slice containing the indices of selected columns.
func GetZipEntry ¶
GetZipEntry gets a pointer to the embedded CSV file.
func IsSanitizeCol ¶
IsSanitizeCol returns true if the specified column name is found in the list of columns that need to be sanitized.
Types ¶
This section is empty.