Documentation
¶
Overview ¶
Package tables - utilities for working with the Tapestry sqlite tables.
Index ¶
- Constants
- func CreateAll(db *sql.DB) (err error)
- func CreateIdl(db *sql.DB) (err error)
- func CreateModel(db *sql.DB) (err error)
- func CreateRun(db *sql.DB) (err error)
- func Insert(table string, keys ...string) string
- func InsertWith(table string, rest string, keys ...string) string
- func Must(db *sql.DB, q string, args ...any)
- func PrintPrep(w io.Writer, err error)
- func QueryAll(db Querier, q string, cb func() error, dest ...any) (err error)
- func QueryStrings(db Querier, q string, args ...any) (ret []string, err error)
- func RowsAffected(res sql.Result) (ret int)
- func ScanAll(rows *sql.Rows, cb func() error, dest ...any) (err error)
- func ScanStrings(rows *sql.Rows) (ret []string, err error)
- func WriteCsv(db Querier, w io.Writer, q string, cols int) (err error)
- type Cache
- func (c *Cache) Close()
- func (c *Cache) DB() *sql.DB
- func (c *Cache) Exec(q string, args ...any) (ret sql.Result, err error)
- func (c *Cache) Must(q string, args ...any)
- func (c *Cache) Query(q string, args ...any) (ret *sql.Rows, err error)
- func (c *Cache) QueryRow(q string, args ...any) (ret RowScanner)
- type Executer
- type Prep
- type Querier
- type QueryRow
- type RowScanner
Constants ¶
const ( ONE_TO_ONE = "one_one" ONE_TO_MANY = "one_any" MANY_TO_ONE = "any_one" MANY_TO_MANY = "any_any" )
cardinality
const ( USUALLY = "usually" ALWAYS = "always" SELDOM = "seldom" NEVER = "never" )
certainty
const DefaultDriver = "sqlite3"
Variables ¶
This section is empty.
Functions ¶
func CreateModel ¶
CreateModel creates the tables listed in model.sql
func Insert ¶
Insert creates a sqlite friendly insert statement. For example: "insert into foo(col1, col2, ...) values(?, ?, ...)"
func PrintPrep ¶
Prep is a utility function that prints a list of errors to w, one error per line, if the err parameter is an Prep. Otherwise it prints the err string.
func QueryAll ¶
QueryAll queries the db ( or statement cache ) for one or more rows. For each row, it writes the row to the 'dest' args and calls 'cb' for processing.
func QueryStrings ¶
where each row is one string.
func RowsAffected ¶
func ScanAll ¶
ScanAll writes each row to the 'dest' args and calls 'cb' for processing. It closes rows before returning.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache mimics the sql.Stmt api, creating the Stmt objects on demand.
type Prep ¶
type Prep []*prepErr
Prep accumulates any errors that occur when creating a series of sql prepared statements.
func (Prep) Err ¶
Err returns an error equivalent to this error list. If the list is empty, Err returns nil.
type RowScanner ¶
RowScanner because sql.Row.Scan doesnt have the sql.Scanner.Scan interface.