rdbms

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: MIT Imports: 16 Imported by: 0

README

To add new connection types:

  1. add to subcommand 'config connections add ' and see actions.RunConnectionAdd()
  2. add to functionality to config.GetConnectionDetails()
  3. ensure the connection type is valid in the action register as part of adding it to func actions.RunConnectionAdd()
  4. add helper types and methods to file rdbms/shared/connection-details-generic.go
  5. enhance ConnectionDetails{}.String() since this redacts user passwords.
  6. DefaultConnectionVariableSuffixes{} needs a new key to support populating ConnectionDetails from environment.
  7. table definition handlers in table-definition/columns.go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSnowflakeConnectionKeyNames = struct {
	AccountName  string
	DatabaseName string
	Warehouse    string
	SchemaName   string
	UserName     string
	Password     string
	RoleName     string
}{
	AccountName:  "accountName",
	DatabaseName: "databaseName",
	Warehouse:    "warehouse",
	SchemaName:   "schemaName",
	UserName:     "userName",
	Password:     "password",
	RoleName:     "roleName",
}

Functions

func NewCqnConnection

func NewCqnConnection(dsnString string) (shared.OracleCqnExecutor, error)

func NewDBConnectionWithMockDripFeed

func NewDBConnectionWithMockDripFeed(log logger.Logger, numRowsToGenerate int, sleepIntervalSec int, dbType string) (shared.Connector, chan string)

func NewMockConnectionWithBatchWithMockTx

func NewMockConnectionWithBatchWithMockTx(log logger.Logger) (shared.Connector, chan string)

func OpenDbConnection

func OpenDbConnection(log logger.Logger, c shared.ConnectionDetails) (db shared.Connector, err error)

OpenDbConnection opens a database connection using the supplied ConnectionDetails struct in c.

func OracleExecWithConnDetails

func OracleExecWithConnDetails(log logger.Logger, connDetails *shared.DsnConnectionDetails, sql string) error

func SnowflakeDDLExec

func SnowflakeDDLExec(log logger.Logger, connDetails *shared.DsnConnectionDetails, sql string) error

func SnowflakeGetDSN

func SnowflakeGetDSN(c *SnowflakeConnectionDetails) (string, error)

SnowflakeGetDSN constructs a DSN based on SnowflakeConnectionDetails. The prefix 'snowflake://' is added to the DSN.

func SqlQuery

func SqlQuery(ctx context.Context, log logger.Logger, db shared.Connector, sqltext string, i shared.SqlResultHandler) error

Types

type SchemaTable

type SchemaTable struct {
	SchemaTable string `errorTxt:"[<schema>.]<object>" mandatory:"yes"`
}

func NewSchemaTable

func NewSchemaTable(schema string, table string) SchemaTable

func (*SchemaTable) AppendSuffix

func (st *SchemaTable) AppendSuffix(suffix string) string

func (*SchemaTable) GetSchema

func (st *SchemaTable) GetSchema() string

func (*SchemaTable) GetTable

func (st *SchemaTable) GetTable() string

func (*SchemaTable) String

func (st *SchemaTable) String() string

type SnowflakeConnectionDetails

type SnowflakeConnectionDetails struct {
	Account        string `errorTxt:"Snowflake account" mandatory:"yes"`
	DBName         string `errorTxt:"Snowflake db name" mandatory:"yes"`
	Schema         string `errorTxt:"Snowflake schema" mandatory:"yes"`
	User           string `errorTxt:"Snowflake username" mandatory:"yes"`
	Password       string `errorTxt:"Snowflake password" mandatory:"yes"`
	Warehouse      string `errorTxt:"Snowflake warehouse"`
	RoleName       string `errorTxt:"Snowflake role name"`
	Dsn            string
	OriginalScheme string
}

func SnowflakeParseDSN

func SnowflakeParseDSN(d string) (*SnowflakeConnectionDetails, error)

SnowflakeParseDSN converts a Snowflake DSN into native connection details. The prefix 'snowflake://' is removed from the DSN if it exists.

func (SnowflakeConnectionDetails) GetMap

func (SnowflakeConnectionDetails) GetScheme

func (d SnowflakeConnectionDetails) GetScheme() (string, error)

func (SnowflakeConnectionDetails) Parse

func (SnowflakeConnectionDetails) String

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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