warehouse

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package warehouse lets a Blacksmith source or destination be considered as a data warehouse. This allows TLT, operations, and queries with Pythonistic SQL direcly on top of databases with no other layer of abstraction.

Note: It is implemented by the third-party package sqlike to easily leverage the standard database/sql and run operations / queries on top of the SQL database. See Go module at https://pkg.go.dev/github.com/nunchistudio/blacksmith-modules/sqlike for more details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsWarehouse

type AsWarehouse interface {

	// AsWarehouse returns a data warehouse so end-user can run SQL operations and
	// queries on top the native dialect of the database.
	AsWarehouse() (*Warehouse, error)
}

AsWarehouse can be implemented by sources and destinations to benefit a template SQL syntax on top of a SQL database for TLT.

Note: It is implemented by the third-party package sqlike to easily leverage the standard database/sql and run operations / queries on top of the SQL database. See Go module at https://pkg.go.dev/github.com/nunchistudio/blacksmith-modules/sqlike for more details.

type Options

type Options struct {

	// Name indicates the identifier of the SQL database which will be used as name
	// for the warehouse.
	//
	// Example: "sqlike(mypostgres)"
	// Required.
	Name string

	// DB is the database connection created using the package database/sql of the
	// standard library.
	//
	// Required.
	DB *sql.DB
}

Options is the options a source or destination can pass to be leveraged as a data warehouse.

type Warehouse

type Warehouse struct {
	// contains filtered or unexported fields
}

Warehouse represents a data warehouse. End-users can run SQL template syntax which compile to SQL, on top of the native dialect of the database.

func New

func New(opts *Options) (*Warehouse, error)

New returns a new data warehouse.

func (*Warehouse) Compile

func (wh *Warehouse) Compile(filename string, data map[string]interface{}) (string, error)

Compile compiles a SQL template to a SQL query string.

func (*Warehouse) Exec

func (wh *Warehouse) Exec(query string) error

Exec executes a SQL query string against the warehouse within a transaction.

func (*Warehouse) Query

func (wh *Warehouse) Query(query string) (*sql.Rows, error)

Query executes a SQL query against the warehouse, returning rows.

Jump to

Keyboard shortcuts

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