package pg
import (
)
var Discard orm.Discard
type NullTime = types.NullTime
func ( ...interface{}) orm.ColumnScanner {
return orm.Scan(...)
}
type Safe = types.Safe
type Ident = types.Ident
func ( string, ...interface{}) *orm.SafeQueryAppender {
return orm.SafeQuery(, ...)
}
func ( interface{}) types.ValueAppender {
return types.In()
}
func ( ...interface{}) types.ValueAppender {
return types.InMulti(...)
}
func ( interface{}) *types.Array {
return types.NewArray()
}
func ( interface{}) *types.Hstore {
return types.NewHstore()
}
func ( internal.Logging) {
internal.Logger =
}
type Query = orm.Query
func ( ...interface{}) *Query {
return orm.NewQuery(nil, ...)
}
func ( context.Context, ...interface{}) *Query {
return orm.NewQueryContext(, nil, ...)
}
type DBI interface {
Model(model ...interface{}) *Query
ModelContext(c context.Context, model ...interface{}) *Query
Exec(query interface{}, params ...interface{}) (Result, error)
ExecContext(c context.Context, query interface{}, params ...interface{}) (Result, error)
ExecOne(query interface{}, params ...interface{}) (Result, error)
ExecOneContext(c context.Context, query interface{}, params ...interface{}) (Result, error)
Query(model, query interface{}, params ...interface{}) (Result, error)
QueryContext(c context.Context, model, query interface{}, params ...interface{}) (Result, error)
QueryOne(model, query interface{}, params ...interface{}) (Result, error)
QueryOneContext(c context.Context, model, query interface{}, params ...interface{}) (Result, error)
Begin() (*Tx, error)
RunInTransaction(ctx context.Context, fn func(*Tx) error) error
CopyFrom(r io.Reader, query interface{}, params ...interface{}) (Result, error)
CopyTo(w io.Writer, query interface{}, params ...interface{}) (Result, error)
}
var (
_ DBI = (*DB)(nil)
_ DBI = (*Tx)(nil)
)
type Strings []string
var (
_ orm.HooklessModel = (*Strings)(nil)
_ types.ValueAppender = (*Strings)(nil)
)
func ( *Strings) () error {
if := *; len() > 0 {
* = [:0]
}
return nil
}
func ( *Strings) () orm.ColumnScanner {
return
}
func (Strings) ( orm.ColumnScanner) error {
return nil
}
func ( *Strings) ( types.ColumnInfo, types.Reader, int) error {
:= make([]byte, )
, := io.ReadFull(, )
if != nil {
return
}
* = append(*, internal.BytesToString())
return nil
}
func ( Strings) ( []byte, int) ([]byte, error) {
if len() == 0 {
return , nil
}
for , := range {
= types.AppendString(, , 1)
= append(, ',')
}
= [:len()-1]
return , nil
}
type Ints []int64
var (
_ orm.HooklessModel = (*Ints)(nil)
_ types.ValueAppender = (*Ints)(nil)
)
func ( *Ints) () error {
if := *; len() > 0 {
* = [:0]
}
return nil
}
func ( *Ints) () orm.ColumnScanner {
return
}
func (Ints) ( orm.ColumnScanner) error {
return nil
}
func ( *Ints) ( types.ColumnInfo, types.Reader, int) error {
, := types.ScanInt64(, )
if != nil {
return
}
* = append(*, )
return nil
}
func ( Ints) ( []byte, int) ([]byte, error) {
if len() == 0 {
return , nil
}
for , := range {
= strconv.AppendInt(, , 10)
= append(, ',')
}
= [:len()-1]
return , nil
}
type IntSet map[int64]struct{}
var _ orm.HooklessModel = (*IntSet)(nil)
func ( *IntSet) () error {
if len(*) > 0 {
* = make(map[int64]struct{})
}
return nil
}
func ( *IntSet) () orm.ColumnScanner {
return
}
func (IntSet) ( orm.ColumnScanner) error {
return nil
}
func ( *IntSet) ( types.ColumnInfo, types.Reader, int) error {
, := types.ScanInt64(, )
if != nil {
return
}
:= *
if == nil {
* = make(IntSet)
= *
}
[] = struct{}{}
return nil
}