DataBaseTools

package module
v0.0.0-...-30424dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 6 Imported by: 0

README

SQL_ToolKit

This library is free of use, and is a helpful list of functions I have used over and over in code.

List of functions to help the end user with their projects To use the tool add toolkit "github.com/David-Billingsley/SQL_ToolKit" to your code base

And in your function put var data DataBaseTools.Data

If a username and password is passed to the functions it will generate the user and password connection string. If there is no user / password then the system will use the Windows Auth connection string.

SQL_File_Read

This function takes the following parameters fpath (filepath), server(SQL Server name), database ( database name), user, password. It will read any file in the current directory, and attempt to pass the query into sql. Checks to see if file is .sql suffix. If the number of files sent is greater then 0 it will send a true message back if zero sends false back.

Get_Column_Info

This function takes the following parameters, server(SQL Server name), database ( database name), user, password, table ( this is the table name ). This function will read the column names and data types found in the table. If the table doesn't exist, the function will return an error. If the table does exist it will return the column names and types in a map.

Get_Table_Names

This function takes the following parameters, server(SQL Server name), database ( database name), user, password. This function will read the table names found in the supplied database. If the tables doesn't exist, the function will return an error. If the tables does exist it will return the column names and types in a map.

Documentation

Overview

Package DataBaseTools provides tools for SQL file import and schema inspection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	MaxFileSize      int
	AllowedFileTypes []string
}

Data holds configuration for file operations.

func (*Data) Get_Column_Info

func (t *Data) Get_Column_Info(server string, database string, user string, pass string, table string) (map[string]string, string)

Get_Column_Info returns the column names and their associated data types.

func (*Data) Get_Table_Names

func (t *Data) Get_Table_Names(server string, database string, user string, pass string) (map[string]string, string)

Get_Table_Names gets all the tables in the particular database.

func (*Data) SQL_File_Import

func (t *Data) SQL_File_Import(fpath string, server string, database string, user string, pass string) (map[string]string, bool)

SQL_File_Import takes a file path and searches that path for files to read and pass into the sql_send function.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL