drivers

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriverMySQL    string = "mysql"
	DriverPostgres string = "postgres"
	DriverSqlite   string = "sqlite3"
	DriverMSSQL    string = "sqlserver"
)

Drivers

View Source
const (
	DefaultRowLimit = 300
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver added in v0.1.3

type Driver interface {
	Connect(urlstr string) error
	TestConnection(urlstr string) error
	GetDatabases() ([]string, error)
	GetTables(database string) (map[string][]string, error)
	GetTableColumns(database, table string) ([][]string, error)
	GetConstraints(database, table string) ([][]string, error)
	GetForeignKeys(database, table string) ([][]string, error)
	GetIndexes(database, table string) ([][]string, error)
	GetRecords(database, table, where, sort string, offset, limit int) ([][]string, int, error)
	UpdateRecord(database, table, column, value, primaryKeyColumnName, primaryKeyValue string) error
	DeleteRecord(database, table string, primaryKeyColumnName, primaryKeyValue string) error
	ExecuteDMLStatement(query string) (string, error)
	ExecuteQuery(query string) ([][]string, error)
	ExecutePendingChanges(changes []models.DBDMLChange) error
	SetProvider(provider string) // NOTE: This is used to get the primary key from the database table until i find a better way to do it. See ResultsTable.go GetPrimaryKeyValue function
	GetProvider() string
	GetPrimaryKeyColumnNames(database, table string) ([]string, error)
}

type MSSQL added in v0.3.3

type MSSQL struct {
	Connection *sql.DB
	Provider   string
}

func (*MSSQL) Connect added in v0.3.3

func (db *MSSQL) Connect(urlstr string) error

func (*MSSQL) DeleteRecord added in v0.3.3

func (db *MSSQL) DeleteRecord(database, table, primaryKeyColumnName, primaryKeyValue string) error

func (*MSSQL) ExecuteDMLStatement added in v0.3.3

func (db *MSSQL) ExecuteDMLStatement(query string) (string, error)

func (*MSSQL) ExecutePendingChanges added in v0.3.3

func (db *MSSQL) ExecutePendingChanges(changes []models.DBDMLChange) error

func (*MSSQL) ExecuteQuery added in v0.3.3

func (db *MSSQL) ExecuteQuery(query string) ([][]string, error)

func (*MSSQL) GetConstraints added in v0.3.3

func (db *MSSQL) GetConstraints(database, table string) ([][]string, error)

func (*MSSQL) GetDatabases added in v0.3.3

func (db *MSSQL) GetDatabases() ([]string, error)

func (*MSSQL) GetForeignKeys added in v0.3.3

func (db *MSSQL) GetForeignKeys(database, table string) ([][]string, error)

func (*MSSQL) GetIndexes added in v0.3.3

func (db *MSSQL) GetIndexes(database, table string) ([][]string, error)

func (*MSSQL) GetPrimaryKeyColumnNames added in v0.3.3

func (db *MSSQL) GetPrimaryKeyColumnNames(database, table string) ([]string, error)

func (*MSSQL) GetProvider added in v0.3.3

func (db *MSSQL) GetProvider() string

func (*MSSQL) GetRecords added in v0.3.3

func (db *MSSQL) GetRecords(database, table, where, sort string, offset, limit int) ([][]string, int, error)

func (*MSSQL) GetTableColumns added in v0.3.3

func (db *MSSQL) GetTableColumns(database, table string) ([][]string, error)

func (*MSSQL) GetTables added in v0.3.3

func (db *MSSQL) GetTables(database string) (map[string][]string, error)

func (*MSSQL) SetProvider added in v0.3.3

func (db *MSSQL) SetProvider(provider string)

func (*MSSQL) TestConnection added in v0.3.3

func (db *MSSQL) TestConnection(urlstr string) error

func (*MSSQL) UpdateRecord added in v0.3.3

func (db *MSSQL) UpdateRecord(database, table, column, value, primaryKeyColumnName, primaryKeyValue string) error

type MySQL added in v0.1.3

type MySQL struct {
	Connection *sql.DB
	Provider   string
}

func (*MySQL) Connect added in v0.1.3

func (db *MySQL) Connect(urlstr string) (err error)

func (*MySQL) DeleteRecord added in v0.1.3

func (db *MySQL) DeleteRecord(database, table, primaryKeyColumnName, primaryKeyValue string) error

func (*MySQL) ExecuteDMLStatement added in v0.1.3

func (db *MySQL) ExecuteDMLStatement(query string) (result string, err error)

func (*MySQL) ExecutePendingChanges added in v0.1.3

func (db *MySQL) ExecutePendingChanges(changes []models.DBDMLChange) (err error)

func (*MySQL) ExecuteQuery added in v0.1.3

func (db *MySQL) ExecuteQuery(query string) (results [][]string, err error)

func (*MySQL) GetConstraints added in v0.1.3

func (db *MySQL) GetConstraints(database, table string) (results [][]string, err error)

func (*MySQL) GetDatabases added in v0.1.3

func (db *MySQL) GetDatabases() ([]string, error)

func (*MySQL) GetForeignKeys added in v0.1.3

func (db *MySQL) GetForeignKeys(database, table string) (results [][]string, err error)

func (*MySQL) GetIndexes added in v0.1.3

func (db *MySQL) GetIndexes(database, table string) (results [][]string, err error)

func (*MySQL) GetPrimaryKeyColumnNames added in v0.3.1

func (db *MySQL) GetPrimaryKeyColumnNames(database, table string) (primaryKeyColumnName []string, err error)

func (*MySQL) GetProvider added in v0.1.3

func (db *MySQL) GetProvider() string

func (*MySQL) GetRecords added in v0.1.3

func (db *MySQL) GetRecords(database, table, where, sort string, offset, limit int) (paginatedResults [][]string, totalRecords int, err error)

func (*MySQL) GetTableColumns added in v0.1.3

func (db *MySQL) GetTableColumns(database, table string) (results [][]string, err error)

func (*MySQL) GetTables added in v0.1.3

func (db *MySQL) GetTables(database string) (map[string][]string, error)

func (*MySQL) SetProvider added in v0.1.3

func (db *MySQL) SetProvider(provider string)

func (*MySQL) TestConnection added in v0.1.3

func (db *MySQL) TestConnection(urlstr string) (err error)

func (*MySQL) UpdateRecord added in v0.1.3

func (db *MySQL) UpdateRecord(database, table, column, value, primaryKeyColumnName, primaryKeyValue string) error

type Postgres added in v0.1.3

type Postgres struct {
	Connection       *sql.DB
	Provider         string
	CurrentDatabase  string
	PreviousDatabase string
	Urlstr           string
}

func (*Postgres) Connect added in v0.1.3

func (db *Postgres) Connect(urlstr string) error

func (*Postgres) DeleteRecord added in v0.1.3

func (db *Postgres) DeleteRecord(database, table, primaryKeyColumnName, primaryKeyValue string) error

func (*Postgres) ExecuteDMLStatement added in v0.1.3

func (db *Postgres) ExecuteDMLStatement(query string) (result string, err error)

func (*Postgres) ExecutePendingChanges added in v0.1.3

func (db *Postgres) ExecutePendingChanges(changes []models.DBDMLChange) error

func (*Postgres) ExecuteQuery added in v0.1.3

func (db *Postgres) ExecuteQuery(query string) ([][]string, error)

func (*Postgres) GetConstraints added in v0.1.3

func (db *Postgres) GetConstraints(database, table string) ([][]string, error)

func (*Postgres) GetDatabases added in v0.1.3

func (db *Postgres) GetDatabases() ([]string, error)

func (*Postgres) GetForeignKeys added in v0.1.3

func (db *Postgres) GetForeignKeys(database, table string) ([][]string, error)

func (*Postgres) GetIndexes added in v0.1.3

func (db *Postgres) GetIndexes(database, table string) ([][]string, error)

func (*Postgres) GetPrimaryKeyColumnNames added in v0.3.1

func (db *Postgres) GetPrimaryKeyColumnNames(database, table string) ([]string, error)

func (*Postgres) GetProvider added in v0.1.3

func (db *Postgres) GetProvider() string

func (*Postgres) GetRecords added in v0.1.3

func (db *Postgres) GetRecords(database, table, where, sort string, offset, limit int) ([][]string, int, error)

func (*Postgres) GetTableColumns added in v0.1.3

func (db *Postgres) GetTableColumns(database, table string) ([][]string, error)

func (*Postgres) GetTables added in v0.1.3

func (db *Postgres) GetTables(database string) (map[string][]string, error)

func (*Postgres) SetProvider added in v0.1.3

func (db *Postgres) SetProvider(provider string)

func (*Postgres) SwitchDatabase added in v0.2.2

func (db *Postgres) SwitchDatabase(database string) error

func (*Postgres) TestConnection added in v0.1.3

func (db *Postgres) TestConnection(urlstr string) error

func (*Postgres) UpdateRecord added in v0.1.3

func (db *Postgres) UpdateRecord(database, table, column, value, primaryKeyColumnName, primaryKeyValue string) error

type SQLite added in v0.1.3

type SQLite struct {
	Connection *sql.DB
	Provider   string
}

func (*SQLite) Connect added in v0.1.3

func (db *SQLite) Connect(urlstr string) (err error)

func (*SQLite) DeleteRecord added in v0.1.3

func (db *SQLite) DeleteRecord(_, table, primaryKeyColumnName, primaryKeyValue string) error

func (*SQLite) ExecuteDMLStatement added in v0.1.3

func (db *SQLite) ExecuteDMLStatement(query string) (result string, err error)

func (*SQLite) ExecutePendingChanges added in v0.1.3

func (db *SQLite) ExecutePendingChanges(changes []models.DBDMLChange) (err error)

func (*SQLite) ExecuteQuery added in v0.1.3

func (db *SQLite) ExecuteQuery(query string) (results [][]string, err error)

func (*SQLite) GetConstraints added in v0.1.3

func (db *SQLite) GetConstraints(_, table string) (results [][]string, err error)

func (*SQLite) GetDatabases added in v0.1.3

func (db *SQLite) GetDatabases() ([]string, error)

func (*SQLite) GetForeignKeys added in v0.1.3

func (db *SQLite) GetForeignKeys(_, table string) (results [][]string, err error)

func (*SQLite) GetIndexes added in v0.1.3

func (db *SQLite) GetIndexes(_, table string) (results [][]string, err error)

func (*SQLite) GetPrimaryKeyColumnNames added in v0.3.1

func (db *SQLite) GetPrimaryKeyColumnNames(database, table string) (primaryKeyColumnName []string, err error)

func (*SQLite) GetProvider added in v0.1.3

func (db *SQLite) GetProvider() string

func (*SQLite) GetRecords added in v0.1.3

func (db *SQLite) GetRecords(_, table, where, sort string, offset, limit int) (paginatedResults [][]string, totalRecords int, err error)

func (*SQLite) GetTableColumns added in v0.1.3

func (db *SQLite) GetTableColumns(_, table string) (results [][]string, err error)

func (*SQLite) GetTables added in v0.1.3

func (db *SQLite) GetTables(database string) (map[string][]string, error)

func (*SQLite) SetProvider added in v0.1.3

func (db *SQLite) SetProvider(provider string)

func (*SQLite) TestConnection added in v0.1.3

func (db *SQLite) TestConnection(urlstr string) (err error)

func (*SQLite) UpdateRecord added in v0.1.3

func (db *SQLite) UpdateRecord(_, table, column, value, primaryKeyColumnName, primaryKeyValue string) error

Jump to

Keyboard shortcuts

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