Documentation
¶
Overview ¶
Package sqlz contains core types such as Kind and Record.
Index ¶
Constants ¶
const ( TableTypeTable = "table" TableTypeView = "view" )
Canonical driver-independent names for "table" and "view".
Variables ¶
var ( RTypeInt = reflect.TypeOf(0) RTypeInt8 = reflect.TypeOf(int8(0)) RTypeInt16 = reflect.TypeOf(int16(0)) RTypeInt32 = reflect.TypeOf(int32(0)) RTypeInt64 = reflect.TypeOf(int64(0)) RTypeInt64P = reflect.TypeOf((*int64)(nil)) RTypeNullInt64 = reflect.TypeOf(sql.NullInt64{}) RTypeFloat32 = reflect.TypeOf(float32(0)) RTypeFloat64 = reflect.TypeOf(float64(0)) RTypeFloat64P = reflect.TypeOf((*float64)(nil)) RTypeNullFloat64 = reflect.TypeOf(sql.NullFloat64{}) RTypeBool = reflect.TypeOf(true) RTypeBoolP = reflect.TypeOf((*bool)(nil)) RTypeNullBool = reflect.TypeOf(sql.NullBool{}) RTypeString = reflect.TypeOf("") RTypeStringP = reflect.TypeOf((*string)(nil)) RTypeNullString = reflect.TypeOf(sql.NullString{}) RTypeTime = reflect.TypeOf(time.Time{}) RTypeTimeP = reflect.TypeOf((*time.Time)(nil)) RTypeNullTime = reflect.TypeOf(sql.NullTime{}) RTypeBytes = reflect.TypeOf([]byte{}) RTypeBytesP = reflect.TypeOf((*[]byte)(nil)) RTypeNil = reflect.TypeOf(nil) RTypeAny = reflect.TypeOf((any)(nil)) )
Cached results from reflect.TypeOf for commonly used types.
Functions ¶
Types ¶
type DB ¶
DB is a union of Execer, Queryer and Preparer. DB's method set is implemented by sql.DB, sql.Conn and sql.Tx. This can probably be better named, as it conflicts with sql.DB.
type Execer ¶
type Execer interface {
// ExecContext is documented by sql.DB.ExecContext.
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}
Execer abstracts the ExecContext method from sql.DB and friends.
type NullBool ¶
NullBool is similar to sql.NullBool, but accepts more boolean representations, e.g. "YES", "Y", "NO", "N", etc. These boolean values are returned by SQL Server and Postgres at times.
type Preparer ¶
type Preparer interface {
// PrepareContext is documented by sql.DB.PrepareContext.
PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
}
Preparer abstracts the PrepareContext method from sql.DB and friends.
type Queryer ¶
type Queryer interface {
// QueryContext is documented by sql.DB.QueryContext.
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
// QueryRowContext is documented by sql.DB.QueryRowContext.
QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}
Queryer abstracts the QueryContext and QueryRowContext methods from sql.DB and friends.