dbqs

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package dbqs provides helper functions that are shared between various tools provided by this module.

Index

Constants

View Source
const (
	SQLQueriesRead  string = "read"
	SQLQueriesNew   string = "new"
	SQLQueriesWrite string = "write"
	SQLQueriesIndex string = "index"
)

Queries used to retrieve data from MySQL database and manage local SQLite database

Variables

This section is empty.

Functions

func PrepareSQLiteDB

func PrepareSQLiteDB(tx *sql.Tx, querySet SQLQuerySet, table string, createIndexes bool) error

PrepareSQLiteDB prepares a SQLite database for incoming data from the source database. As of the current version, this includes dropping tables and recreating them along with optional indexes, if enabled.

func RowsCount

func RowsCount(db *sql.DB, table string) (int, error)

RowsCount returns the number of rows for a specified table.

func VerifyDBConn

func VerifyDBConn(ctx context.Context, db *sql.DB, retries int, retryDelay time.Duration, timeout time.Duration) error

VerifyDBConn is used to verify connectivity to a specified database. If the initial verification fails, a specified number of further attempts are made before an error is returned to signal that a database connection is unavailable.

Types

type SQLQueries

type SQLQueries map[string]map[string]string

SQLQueries is a map of maps representing a collection of tables and the queries used to read from a source database and write to a SQLite database. Example: queries["virtual_domains"]["read"] = "SELECT * FROM virtual_domains"

type SQLQuerySet

type SQLQuerySet map[string]string

SQLQuerySet is a map of query type to query. Each entry is used to read from a source database table, create, write to or update indexes for a new database table in the generated SQLite database.

Jump to

Keyboard shortcuts

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