engine

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	Storage
	// contains filtered or unexported fields
}

Engine is responsible for sql related read operations.

func New

func New(s Storage, timeout time.Duration) *Engine

New creates a new sql reader engine.

func (*Engine) FormatColumn

func (e *Engine) FormatColumn(tableName string, columnName string) string

FormatColumn returns a escaped table+column string

func (*Engine) GetColumns

func (e *Engine) GetColumns(tableName string) ([]string, error)

GetColumns returns the columns in the specified database table

func (*Engine) GetTables

func (e *Engine) GetTables() ([]string, error)

GetTables gets a list of all tables in the database

func (*Engine) ReadTable

func (e *Engine) ReadTable(tableName string, rowChan chan<- database.Row, opts reader.ReadTableOpt) error

ReadTable returns a list of all rows in a table

type Storage

type Storage interface {
	// GetStructure returns the SQL used to create the database tables
	GetStructure() (string, error)
	// GetTables return a list of all database tables
	GetTables() ([]string, error)
	// GetColumns return a list of all columns for a given table
	GetColumns(string) ([]string, error)
	// QuoteIdentifier returns a quoted instance of a identifier (table, column etc.)
	QuoteIdentifier(string) string
	// Conn return the sql.DB connection
	Conn() *sql.DB
	// Close closes the reader resources and releases them.
	Close() error
}

Storage is the read storage database interface.

Jump to

Keyboard shortcuts

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