DataBaseTools

package module
v0.0.0-...-17201cb Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 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

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
}

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)

#region: Get Column Info This function 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)

#region: Get Tables This function will get 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)

#region: SQL File Find This function 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