databases

package
v0.0.0-...-d400e7b Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	ListTables(ctx context.Context) ([]string, error)
	ListViews(ctx context.Context) ([]string, error)
	// ListColumns returns the columns of a table in the order they are defined in the table.
	// If the table does not exist, an error is returned.
	ListColumns(ctx context.Context, table string) ([]string, error)
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
	// Close the connection to the database. Easily used with defer.
	// TODO Make sure this is called in the main functions.
	Close(ctx context.Context) error

	// SeedsDropTableQuery drops a table if it exists.
	SeedsDropTableQuery(tableName string) string
	// SeedsCreateTableQuery drops a table if it exists where the columns are Text/String equivalent.
	SeedsCreateTableQuery(tableName string, columns []string) (string, error)
	// SeedsInsertIntoTableQuery inserts values into a table.
	SeedsInsertIntoTableQuery(tableName string, columns []string, values [][]string) (string, error)

	// ReturnFullPathRequirement takes in the name of the target table and prefixes it with any necessary schema/paths
	// to make it a full path.
	ReturnFullPathRequirement(tableName string) string
}

Jump to

Keyboard shortcuts

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