databaseio

package
v2.25.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package databaseio provides transformations and utilities to interact with generic database database/sql API. See also: https://golang.org/pkg/database/sql/

Package databaseio provides transformations and utilities to interact with generic database database/sql API. See also: https://golang.org/pkg/database/sql/

Package databaseio provides transformations and utilities to interact with generic database database/sql API. See also: https://golang.org/pkg/database/sql/

Package databaseio provides transformations and utilities to interact with generic database database/sql API. See also: https://golang.org/pkg/database/sql/

Package databaseio provides transformations and utilities to interact with generic database database/sql API. See also: https://golang.org/pkg/database/sql/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

func Query(s beam.Scope, driver, dsn, q string, t reflect.Type) beam.PCollection

Query executes a query. The output must have a schema compatible with the given type, t. It returns a PCollection<t>.

func Read

func Read(s beam.Scope, driver, dsn, table string, t reflect.Type) beam.PCollection

Read reads all rows from the given table. The table must have a schema compatible with the given type, t, and Read returns a PCollection<t>. If the table has more rows than t, then Read is implicitly a projection.

func Write

func Write(s beam.Scope, driver, dsn, table string, columns []string, col beam.PCollection)

Write writes the elements of the given PCollection<T> to database, if columns left empty all table columns are used to insert into, otherwise selected

func WriteWithBatchSize

func WriteWithBatchSize(s beam.Scope, batchSize int, driver, dsn, table string, columns []string, col beam.PCollection)

WriteWithBatchSize writes the elements of the given PCollection<T> to database with custom batch size. Batch size control number of elements in the batch INSERT statement.

Types

type MapLoader

type MapLoader interface {
	LoadMap(row map[string]interface{}) error
}

MapLoader calls on LoadMap method with with a fetched row as map.

type SliceLoader

type SliceLoader interface {
	LoadSlice(row []interface{}) error
}

SliceLoader calls LoadSlice method with a fetched row as slice.

type Writer

type Writer interface {
	SaveData() (map[string]interface{}, error)
}

Writer returns a row of data to be inserted into a table.

Jump to

Keyboard shortcuts

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