statements

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package statements builds uses a grammar to build SQL statements scoped to entities within the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Expect

type Expect int

Expect is an enum describing what to expect when running a query.

const (
	ExpectNone Expect = iota
	ExpectRow
	ExpectRowOrNone
	ExpectRows
)

func (Expect) String

func (me Expect) String() string

String returns the Expect value as a string.

type Query

type Query struct {
	// SQL is the query statement.
	SQL string
	// If the query requires arguments then Arguments are the column name arguments in
	// the order expected by the SQL statement.
	Arguments []string
	// If the query returns columns then Scan are the column names in the order
	// to be scanned.
	Scan []string
	// Expect is a hint that indicates if the query returns no rows, one row, or many rows.
	Expect Expect
}

Query describes a SQL query.

func (*Query) String

func (me *Query) String() string

String describes the Query as a string.

type Table

type Table struct {
	Delete *Query
	Insert *Query
	Update *Query
	Upsert *Query
}

Table is the collection of Query types to perform CRUD against a table.

func (Table) String

func (me Table) String() string

String returns the table statements as a friendly string.

Jump to

Keyboard shortcuts

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