Documentation ¶
Index ¶
- Variables
- func AsBool(rb sql.RawBytes) bool
- func AsByteArray(rb sql.RawBytes) []byte
- func AsFloat64(rb sql.RawBytes) float64
- func AsInt(rb sql.RawBytes) int
- func AsInt64(rb sql.RawBytes) int64
- func AsString(rb sql.RawBytes) string
- func AsTime(rb sql.RawBytes) time.Time
- func WithinTx(db *Db, functor WithinTxFunctor) error
- type Column
- type Db
- type DbTx
- type Filter
- type Option
- type OptionFloat64
- type OptionInt
- type OptionInt64
- type OptionString
- type OptionTime
- type Query
- type QueryRowVisitor
- type TableModel
- type Tx
- type WithinTxFunctor
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoPrimaryKeyDefined = errors.New("Cannot call this, because there is no primary key defined for the model.") ErrNotSupportedCall = errors.New("Such api cannot be called on this query, e.g. SelectOne on an InsertQuery.") ErrNotEnoughColumns = errors.New("Not enough columns data for Insert/Update.") ErrMultipleRowReturned = errors.New("Multiple row returned, but suppose there is only one row.") ErrNotDbTxObject = errors.New("This is not a valid database/sql.Db or sql.Tx") )
View Source
var Debug bool
View Source
var (
ErrOptionIsNone = errors.New("Option is not valid.")
)
Functions ¶
func AsByteArray ¶
func WithinTx ¶
func WithinTx(db *Db, functor WithinTxFunctor) error
Types ¶
type Db ¶
func (*Db) DriverName ¶
type Filter ¶
type Filter interface { SqlString(alias string, driverName string) string Params() []interface{} And(Filter) Filter Or(Filter) Filter }
func UnitFilter ¶
type OptionFloat64 ¶
func NoneFloat64 ¶
func NoneFloat64() OptionFloat64
func SomeFloat64 ¶
func SomeFloat64(n float64) OptionFloat64
type OptionInt64 ¶
func NoneInt64 ¶
func NoneInt64() OptionInt64
func SomeInt64 ¶
func SomeInt64(n int64) OptionInt64
type OptionString ¶
func NoneString ¶
func NoneString() OptionString
func SomeString ¶
func SomeString(n string) OptionString
type OptionTime ¶
func NoneTime ¶
func NoneTime() OptionTime
func SomeTime ¶
func SomeTime(n time.Time) OptionTime
type Query ¶
type Query interface { String() string Exec(dbtx DbTx) (sql.Result, error) SelectOne(dbtx DbTx, functor QueryRowVisitor) error SelectList(dbtx DbTx, functor QueryRowVisitor) error SelectCount(dbtx DbTx, functor QueryRowVisitor) error Where(f Filter) Query OrderBy(by ...string) Query Limit(offsets ...int64) Query Page(number, size int) Query GroupBy(by ...string) Query }
func Delete ¶
func Delete(model TableModel) Query
func Insert ¶
func Insert(model TableModel, columns []Column) Query
func Select ¶
func Select(model TableModel, columns []Column) Query
func Update ¶
func Update(model TableModel, columns []Column) Query
type TableModel ¶
type TableModel interface {
Names() (schema, tbl, alias string)
}
type Tx ¶
func (*Tx) DriverName ¶
type WithinTxFunctor ¶
Click to show internal directories.
Click to hide internal directories.