sqlParser

package
v0.0.0-...-dd73e6d Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRow

func AddRow(newRow interface{}, tableName string) error

adds new row to table

func AddRows

func AddRows(newRows []interface{}, tableName string) error

func Delete

func Delete(serverTableName string, parameters []string) (bool, error)

********************************************************************************

  • DELETE FUNCTIONALITY *******************************************************************************

func DeleteFromTable

func DeleteFromTable(tableName string, parameters []string) error

deletes from a table

func DeleteFromView

func DeleteFromView(viewName string, parameters []string) (bool, error)

deletes from a view

func Get

func Get(tableName string) ([]map[string]interface{}, error)

func GetColTypeMap

func GetColTypeMap() map[string]string

returns a map of each column name in table to its appropriate GoLang tpye (name string)

func GetColumnNames

func GetColumnNames(tableName string) []string

returns array of column names from table in database

func GetForeignKeyColumns

func GetForeignKeyColumns(tableName string) ([]string, map[string]map[string]interface{})

func GetForeignKeyMap

func GetForeignKeyMap() map[string]ForeignKey

func GetForeignKeyRows

func GetForeignKeyRows(tableName string) map[string]map[string]interface{}

func GetForeignKeyValues

func GetForeignKeyValues(tableName string, colName string) map[string]interface{}

func GetTableMap

func GetTableMap() map[string][]string

func GetTableNames

func GetTableNames() []string

returns array of table name strings from queried database

func InitializeDatabase

func InitializeDatabase(username string, password string, environment string) sqlx.DB

********************************************************************************

  • DB INITIALIZE: Connects given DB creds, creates ColMap FOR SESSION *******************************************************************************

func IsTable

func IsTable(serverTableName string) bool

********************************************************************************

  • HELPER FUNCTIONS *******************************************************************************

if is table, returns 1. else (for example, is view), returns 0.

func MakeView

func MakeView(viewName string, view string) error

func Post

func Post(tableName string, jsonByte []byte) (string, error)

********************************************************************************

  • POST FUNCTIONALITY *******************************************************************************

func PostRows

func PostRows(tableName string, jsonByte []byte) error

adds JSON from FILENAME to TABLE CURRENTLY ONLY ONE ROW

func PostViews

func PostViews(jsonByte []byte) (string, error)

adds JSON from FILENAME to TABLE

func Put

func Put(tableName string, parameters []string, jsonByte []byte) error

********************************************************************************

  • PUT FUNCTIONALITY *******************************************************************************

func RunDeleteQuery

func RunDeleteQuery(serverTableName string, parameters []string) error

runs query of format "delete from tableName where parameterA=valueA and..."

func StringToType

func StringToType(b []byte, t string) (interface{}, error)

given a []byte b and type t, return b in t form

func TypeToString

func TypeToString(data interface{}) (string, error)

given data of generic type, returns data of string type

func UpdateRow

func UpdateRow(newRow interface{}, tableName string, parameters []string) error

func UpdateRows

func UpdateRows(newRows []interface{}, tableName string, parameters []string) error

Types

type ForeignKey

type ForeignKey struct {
	Table     string
	Column    string
	Alias     string
	ColValues map[string]interface{}
}

func MakeForeignKey

func MakeForeignKey(table string, column string, alias string) ForeignKey

type View

type View struct {
	Name  string
	Query string
}

view details are marshalled into this View struct

Jump to

Keyboard shortcuts

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