jdbc

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapScan

func MapScan(rows *sql.Rows, dest map[string]any, converter func(value interface{}, columnType string) (interface{}, error)) error

func MinMaxQuery

func MinMaxQuery(stream types.StreamInterface, column string) string

MinMaxQuery returns the query to fetch MIN and MAX values of a column in a Postgres table

func MinMaxQueryMySQL

func MinMaxQueryMySQL(stream types.StreamInterface, columns []string) string

MinMaxQueryMySQL returns the query to fetch MIN and MAX values of a column in a MySQL table

func MySQLDiscoverTablesQuery

func MySQLDiscoverTablesQuery() string

MySQLDiscoverTablesQuery returns the query to discover tables in a MySQL database

func MySQLMasterStatusQuery

func MySQLMasterStatusQuery() string

MySQLMasterStatusQuery returns the query to fetch the current binlog position in MySQL: mysql v8.3 and below

func MySQLMasterStatusQueryNew

func MySQLMasterStatusQueryNew() string

MySQLMasterStatusQuery returns the query to fetch the current binlog position in MySQL: mysql v8.4 and above

func MySQLPrimaryKeyQuery

func MySQLPrimaryKeyQuery() string

MySQLPrimaryKeyQuery returns the query to fetch the primary key column of a table in MySQL

func MySQLTableColumnsQuery

func MySQLTableColumnsQuery() string

MySQLTableColumnsQuery returns the query to fetch column names of a table in MySQL

func MySQLTableRowsQuery

func MySQLTableRowsQuery() string

MySQLTableRowsQuery returns the query to fetch the estimated row count of a table in MySQL

func MySQLTableSchemaQuery

func MySQLTableSchemaQuery() string

MySQLTableSchemaQuery returns the query to fetch schema information for a table in MySQL

func MySQLVersion

func MySQLVersion(client *sqlx.DB) (int, int, error)

MySQLVersion returns the version of the MySQL server It returns the major and minor version of the MySQL server

func MysqlChunkScanQuery

func MysqlChunkScanQuery(stream types.StreamInterface, filterColumns []string, chunk types.Chunk) string

MySQLWithoutState builds a chunk scan query for MySql

func MysqlLimitOffsetScanQuery

func MysqlLimitOffsetScanQuery(stream types.StreamInterface, chunk types.Chunk) string

MysqlLimitOffsetScanQuery is used to get the rows

func NextChunkEndQuery

func NextChunkEndQuery(stream types.StreamInterface, columns []string, chunkSize int64) string

NextChunkEndQuery returns the query to calculate the next chunk boundary Example: Input:

stream.Namespace() = "mydb"
stream.Name() = "users"
columns = []string{"id", "created_at"}
chunkSize = 1000

Output:

SELECT MAX(key_str) FROM (
  SELECT CONCAT_WS(',', id, created_at) AS key_str
  FROM `mydb`.`users`
  WHERE (`id` > ?) OR (`id` = ? AND `created_at` > ?)
  ORDER BY id, created_at
  LIMIT 1000
) AS subquery

func NextRowIDQuery added in v0.1.3

func NextRowIDQuery(stream types.StreamInterface, currentSCN string, ROWID string, chunkSize int64) string

NextRowIDQuery returns the query to fetch the next max row id

func OracleChunkScanQuery added in v0.1.3

func OracleChunkScanQuery(stream types.StreamInterface, chunk types.Chunk) string

OracleChunkScanQuery returns the query to fetch the rows of a table in OracleDB

func OracleCurrentSCNQuery added in v0.1.3

func OracleCurrentSCNQuery() string

OracleCurrentSCNQuery returns the query to fetch the current SCN in OracleDB

func OracleEmptyCheckQuery added in v0.1.3

func OracleEmptyCheckQuery(stream types.StreamInterface) string

OracleEmptyCheckQuery returns the query to check if a table is empty in OracleDB

func OracleMinMaxCountQuery added in v0.1.3

func OracleMinMaxCountQuery(stream types.StreamInterface, currentSCN string) string

OracleMinMaxCountQuery returns the query to fetch the min ROWID, max ROWID and number of rows of a table in OracleDB

func OraclePrimaryKeyColummsQuery added in v0.1.3

func OraclePrimaryKeyColummsQuery(schemaName, tableName string) string

OraclePrimaryKeyQuery returns the query to fetch all the primary key columns of a table in OracleDB

func OracleTableDetailsQuery added in v0.1.3

func OracleTableDetailsQuery(schemaName, tableName string) string

OracleTableDetailsQuery returns the query to fetch the details of a table in OracleDB

func OracleTableSizeQuery added in v0.1.3

func OracleTableSizeQuery(stream types.StreamInterface) string

OracleTableSizeQuery returns the query to fetch the size of a table in bytes in OracleDB

func PostgresChunkScanQuery

func PostgresChunkScanQuery(stream types.StreamInterface, filterColumn string, chunk types.Chunk) string

PostgresBuildSplitScanQuery builds a chunk scan query for PostgreSQL

func PostgresMinQuery

func PostgresMinQuery(stream types.StreamInterface, filterColumn string, filterValue interface{}) string

PostgresMinQuery returns the query to fetch the minimum value of a column in PostgreSQL

func PostgresNextChunkEndQuery

func PostgresNextChunkEndQuery(stream types.StreamInterface, filterColumn string, filterValue interface{}, batchSize int) string

PostgresNextChunkEndQuery generates a SQL query to fetch the maximum value of a specified column

func PostgresRelPageCount

func PostgresRelPageCount(stream types.StreamInterface) string

PostgresRelPageCount returns the query to fetch relation page count in PostgreSQL

func PostgresRowCountQuery

func PostgresRowCountQuery(stream types.StreamInterface) string

PostgresRowCountQuery returns the query to fetch the estimated row count in PostgreSQL

func PostgresWalLSNQuery

func PostgresWalLSNQuery() string

PostgresWalLSNQuery returns the query to fetch the current WAL LSN in PostgreSQL

func PostgresWithState

func PostgresWithState(stream types.StreamInterface) string

PostgresWithState returns the query for a SELECT with state

func PostgresWithoutState

func PostgresWithoutState(stream types.StreamInterface) string

PostgresWithoutState returns the query for a simple SELECT without state

func WithIsolation

func WithIsolation(ctx context.Context, client *sqlx.DB, fn func(tx *sql.Tx) error) error

Types

type Reader

type Reader[T types.Iterable] struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader[T types.Iterable](ctx context.Context, baseQuery string, batchSize int,
	exec func(ctx context.Context, query string, args ...any) (T, error), args ...any) *Reader[T]

func (*Reader[T]) Capture

func (o *Reader[T]) Capture(onCapture func(T) error) error

Jump to

Keyboard shortcuts

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