sql

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

View Source
const (

	// Int64ToBool casts an int64 type into a bool,
	// useful for handling SQLite INT -> BOOL.
	Int64ToBool coerceType
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CoercePair

type CoercePair struct {
	Column string
	Type   coerceType
}

CoercePair casts the scanned value in Column to another type.

type Config

type Config qsqlio.SQLConfig

Config holds configuration parameters for reading/writing to/from a SQL DB.

func NewConfig

func NewConfig(ff []ConfigFunc) Config

NewConfig creates a new config object.

type ConfigFunc

type ConfigFunc func(*Config)

ConfigFunc manipulates a Config object.

func Coerce

func Coerce(pairs ...CoercePair) ConfigFunc

Coerce accepts a map of column names that will be cast explicitly into the desired type.

func EscapeChar

func EscapeChar(r rune) ConfigFunc

EscapeChar is a rune which column and table names will be escaped with. PostgreSQL and SQLite both accept double quotes "" while MariaDB/MySQL only accept backticks.

func Incrementing

func Incrementing() ConfigFunc

Incrementing indicates the PostgreSQL variant of parameter markers will be used, e.g. $1..$2. The default style is ?..?.

func MySQL

func MySQL() ConfigFunc

MySQL configures the query builder to generate SQL that is compatible with MySQL/MariaDB See github.com/go-sql-driver/mysql

func Postgres

func Postgres() ConfigFunc

Postgres configures the query builder to generate SQL that is compatible with PostgreSQL. See github.com/lib/pq

func Precision

func Precision(i int) ConfigFunc

Precision sets the precision float64 types will be rounded to when read from SQL.

func Query

func Query(query string) ConfigFunc

Query is a Raw SQL statement which must return appropriate types which can be inferred and loaded into a new QFrame.

func SQLite

func SQLite() ConfigFunc

SQLite configures the query builder to generate SQL that is compatible with SQLite3. See github.com/mattn/go-sqlite3

func Table

func Table(table string) ConfigFunc

Table is the name of the table to be used for generating an INSERT statement.

Jump to

Keyboard shortcuts

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