Documentation ¶
Overview ¶
Package db provides an abstract database interface for Go.
types.go2:1
Example ¶
package main import ( "fmt" "qlova.store/db" ) type UserViewer struct { db.View `db:"users"` ID db.UUID `db:",key"` Name db.String } func main() { var User UserViewer defer db.Open().Connect(&User).Close() db.Sync(User) var bob = User bob.Name.Set("Bob") db.Insert(bob) var user = User db.If(user.Name.Equals("Bob")).Get(&user) fmt.Println(user.Name) }
Output: Bob
Index ¶
- Variables
- func Connect(viewer Viewer, driver Driver) error
- func Delete(table Viewer, tables ...Viewer) error
- func Empty(table Viewer, tables ...Viewer) error
- func Insert(first Row, rows ...Row) error
- func Sync(table Table, tables ...Table) error
- func Tokenise(text string) (words []string)
- type Bool
- func (t Bool) Column() string
- func (t Bool) Database() Driver
- func (t Bool) Decreasing() Sorter
- func (t Bool) Equals(val bool) Condition
- func (t Bool) FieldName() string
- func (t Bool) Increasing() Sorter
- func (t *Bool) Index(index int) bool
- func (t Bool) Interface() interface{}
- func (t Bool) Key() bool
- func (t *Bool) Make(length int) interface{}
- func (t Bool) MarshalJSON() ([]byte, error)
- func (t *Bool) Master() bool
- func (t Bool) NotEquals(val bool) Condition
- func (t Bool) Offset() uintptr
- func (t Bool) On(other struct{ ... }) Linker
- func (t *Bool) Pointer() interface{}
- func (t *Bool) Set(val bool)
- func (t *Bool) Slice(index int) interface{}
- func (t Bool) String() string
- func (t Bool) Table() string
- func (t Bool) Test(ctx *testing.T)
- func (t Bool) To(val bool) Update
- func (t Bool) Type() reflect.Type
- func (t Bool) Value() bool
- type Builtin
- func (Builtin) Close() error
- func (b Builtin) Connect(first Viewer, more ...Viewer) Driver
- func (b Builtin) Delete(table Table, tables ...Table) error
- func (b Builtin) Empty(table Table, tables ...Table) error
- func (b Builtin) Insert(row Row, rows ...Row) error
- func (b Builtin) Search(f Filter) Results
- func (b Builtin) Sync(table Table, tables ...Table) error
- type Bytes
- func (t Bytes) Column() string
- func (t Bytes) Database() Driver
- func (t Bytes) Decreasing() Sorter
- func (t Bytes) Equals(val []byte) Condition
- func (t Bytes) FieldName() string
- func (t Bytes) Increasing() Sorter
- func (t *Bytes) Index(index int) bool
- func (t Bytes) Interface() interface{}
- func (t Bytes) Key() bool
- func (t *Bytes) Make(length int) interface{}
- func (t Bytes) MarshalJSON() ([]byte, error)
- func (t *Bytes) Master() bool
- func (t Bytes) NotEquals(val []byte) Condition
- func (t Bytes) Offset() uintptr
- func (t Bytes) On(other struct{ ... }) Linker
- func (t *Bytes) Pointer() interface{}
- func (t *Bytes) Set(val []byte)
- func (t *Bytes) Slice(index int) interface{}
- func (t Bytes) String() string
- func (t Bytes) Table() string
- func (t Bytes) Test(ctx *testing.T)
- func (t Bytes) To(val []byte) Update
- func (t Bytes) Type() reflect.Type
- func (t Bytes) Value() []byte
- type Column
- type Condition
- type Dictionary
- type DictionaryMap
- type Driver
- type Error
- type Expression
- type Filter
- func (f Filter) Average(v Viewable) (float64, error)
- func (f Filter) Count(v Viewable) (int, error)
- func (f Filter) Delete() (int, error)
- func (f Filter) Get(v Viewer) error
- func (f Filter) If(condition Condition, conditions ...Condition) Filter
- func (f Filter) MarshalJSON() ([]byte, error)
- func (f Filter) Read(v Variable, vs ...Variable) error
- func (f Filter) Slice(offset, length int, columns ...Variable) Slicer
- func (f Filter) SortBy(sorter Sorter, sorters ...Sorter) Filter
- func (f Filter) Sum(v Variable) error
- func (f Filter) Update(update Update, updates ...Update) (int, error)
- type Float32
- func (t Float32) Column() string
- func (t Float32) Database() Driver
- func (t Float32) Decreasing() Sorter
- func (t Float32) Equals(val float64) Condition
- func (t Float32) FieldName() string
- func (t Float32) Increasing() Sorter
- func (t *Float32) Index(index int) bool
- func (t Float32) Interface() interface{}
- func (t Float32) Key() bool
- func (t *Float32) Make(length int) interface{}
- func (t Float32) MarshalJSON() ([]byte, error)
- func (t *Float32) Master() bool
- func (t Float32) NotEquals(val float64) Condition
- func (t Float32) Offset() uintptr
- func (t Float32) On(other struct{ ... }) Linker
- func (t *Float32) Pointer() interface{}
- func (t *Float32) Set(val float64)
- func (t *Float32) Slice(index int) interface{}
- func (t Float32) String() string
- func (t Float32) Table() string
- func (t Float32) Test(ctx *testing.T)
- func (t Float32) To(val float64) Update
- func (t Float32) Type() reflect.Type
- func (t Float32) Value() float64
- type Float64
- func (t Float64) Column() string
- func (t Float64) Database() Driver
- func (t Float64) Decreasing() Sorter
- func (t Float64) Equals(val float64) Condition
- func (t Float64) FieldName() string
- func (t Float64) Increasing() Sorter
- func (t *Float64) Index(index int) bool
- func (t Float64) Interface() interface{}
- func (t Float64) Key() bool
- func (t *Float64) Make(length int) interface{}
- func (t Float64) MarshalJSON() ([]byte, error)
- func (t *Float64) Master() bool
- func (t Float64) NotEquals(val float64) Condition
- func (t Float64) Offset() uintptr
- func (t Float64) On(other struct{ ... }) Linker
- func (t *Float64) Pointer() interface{}
- func (t *Float64) Set(val float64)
- func (t *Float64) Slice(index int) interface{}
- func (t Float64) String() string
- func (t Float64) Table() string
- func (t Float64) Test(ctx *testing.T)
- func (t Float64) To(val float64) Update
- func (t Float64) Type() reflect.Type
- func (t Float64) Value() float64
- type Importable୦
- type Insertion
- type Int16
- func (t Int16) Column() string
- func (t Int16) Database() Driver
- func (t Int16) Decreasing() Sorter
- func (t Int16) Equals(val int16) Condition
- func (t Int16) FieldName() string
- func (t Int16) Increasing() Sorter
- func (t *Int16) Index(index int) bool
- func (t Int16) Interface() interface{}
- func (t Int16) Key() bool
- func (t *Int16) Make(length int) interface{}
- func (t Int16) MarshalJSON() ([]byte, error)
- func (t *Int16) Master() bool
- func (t Int16) NotEquals(val int16) Condition
- func (t Int16) Offset() uintptr
- func (t Int16) On(other struct{ ... }) Linker
- func (t *Int16) Pointer() interface{}
- func (t *Int16) Set(val int16)
- func (t *Int16) Slice(index int) interface{}
- func (t Int16) String() string
- func (t Int16) Table() string
- func (t Int16) Test(ctx *testing.T)
- func (t Int16) To(val int16) Update
- func (t Int16) Type() reflect.Type
- func (t Int16) Value() int16
- type Int32
- func (t Int32) Column() string
- func (t Int32) Database() Driver
- func (t Int32) Decreasing() Sorter
- func (t Int32) Equals(val int32) Condition
- func (t Int32) FieldName() string
- func (t Int32) Increasing() Sorter
- func (t *Int32) Index(index int) bool
- func (t Int32) Interface() interface{}
- func (t Int32) Key() bool
- func (t *Int32) Make(length int) interface{}
- func (t Int32) MarshalJSON() ([]byte, error)
- func (t *Int32) Master() bool
- func (t Int32) NotEquals(val int32) Condition
- func (t Int32) Offset() uintptr
- func (t Int32) On(other struct{ ... }) Linker
- func (t *Int32) Pointer() interface{}
- func (t *Int32) Set(val int32)
- func (t *Int32) Slice(index int) interface{}
- func (t Int32) String() string
- func (t Int32) Table() string
- func (t Int32) Test(ctx *testing.T)
- func (t Int32) To(val int32) Update
- func (t Int32) Type() reflect.Type
- func (t Int32) Value() int32
- type Int64
- func (t Int64) Column() string
- func (t Int64) Database() Driver
- func (t Int64) Decreasing() Sorter
- func (i Int64) DivisibleBy(val int64) Condition
- func (t Int64) Equals(val int64) Condition
- func (t Int64) FieldName() string
- func (t Int64) Increasing() Sorter
- func (t *Int64) Index(index int) bool
- func (t Int64) Interface() interface{}
- func (t Int64) Key() bool
- func (i Int64) LessThan(val int64) Condition
- func (t *Int64) Make(length int) interface{}
- func (t Int64) MarshalJSON() ([]byte, error)
- func (t *Int64) Master() bool
- func (t Int64) NotEquals(val int64) Condition
- func (t Int64) Offset() uintptr
- func (t Int64) On(other struct{ ... }) Linker
- func (t *Int64) Pointer() interface{}
- func (t *Int64) Set(val int64)
- func (t *Int64) Slice(index int) interface{}
- func (t Int64) String() string
- func (t Int64) Table() string
- func (t Int64) Test(ctx *testing.T)
- func (t Int64) To(val int64) Update
- func (t Int64) Type() reflect.Type
- func (t Int64) Value() int64
- type Int8
- func (t Int8) Column() string
- func (t Int8) Database() Driver
- func (t Int8) Decreasing() Sorter
- func (t Int8) Equals(val int8) Condition
- func (t Int8) FieldName() string
- func (t Int8) Increasing() Sorter
- func (t *Int8) Index(index int) bool
- func (t Int8) Interface() interface{}
- func (t Int8) Key() bool
- func (t *Int8) Make(length int) interface{}
- func (t Int8) MarshalJSON() ([]byte, error)
- func (t *Int8) Master() bool
- func (t Int8) NotEquals(val int8) Condition
- func (t Int8) Offset() uintptr
- func (t Int8) On(other struct{ ... }) Linker
- func (t *Int8) Pointer() interface{}
- func (t *Int8) Set(val int8)
- func (t *Int8) Slice(index int) interface{}
- func (t Int8) String() string
- func (t Int8) Table() string
- func (t Int8) Test(ctx *testing.T)
- func (t Int8) To(val int8) Update
- func (t Int8) Type() reflect.Type
- func (t Int8) Value() int8
- type Iterator
- type LinkablesViewer
- type Linker
- type Operator
- type Results
- type Row
- type Rune
- type Slicer
- type Sorter
- type String
- func (t String) Column() string
- func (s String) Contains(val string) Condition
- func (t String) Database() Driver
- func (t String) Decreasing() Sorter
- func (t String) Equals(val string) Condition
- func (t String) FieldName() string
- func (s String) HasPrefix(val string) Condition
- func (t String) Increasing() Sorter
- func (t *String) Index(index int) bool
- func (t String) Interface() interface{}
- func (t String) Key() bool
- func (t *String) Make(length int) interface{}
- func (t String) MarshalJSON() ([]byte, error)
- func (t *String) Master() bool
- func (t String) NotEquals(val string) Condition
- func (t String) Offset() uintptr
- func (t String) On(other struct{ ... }) Linker
- func (t *String) Pointer() interface{}
- func (t *String) Set(val string)
- func (t *String) Slice(index int) interface{}
- func (t String) String() string
- func (t String) Table() string
- func (t String) Test(ctx *testing.T)
- func (t String) To(val string) Update
- func (t String) Type() reflect.Type
- func (t String) Value() string
- type Table
- type TestSuite
- func (ts *TestSuite) SetupSuite()
- func (ts *TestSuite) TestConnect()
- func (ts *TestSuite) TestDelete()
- func (ts *TestSuite) TestEmpty()
- func (ts *TestSuite) TestInsert()
- func (ts *TestSuite) TestLink()
- func (ts *TestSuite) TestPrimaryKey()
- func (ts *TestSuite) TestResultsAverage()
- func (ts *TestSuite) TestResultsCount()
- func (ts *TestSuite) TestResultsDelete()
- func (ts *TestSuite) TestResultsGet()
- func (ts *TestSuite) TestResultsJSON()
- func (ts *TestSuite) TestResultsNotFound()
- func (ts *TestSuite) TestResultsRead()
- func (ts *TestSuite) TestResultsSlice()
- func (ts *TestSuite) TestResultsSum()
- func (ts *TestSuite) TestResultsUpdate()
- func (ts *TestSuite) TestSync()
- func (ts *TestSuite) TestTypes()
- type TestablesViewer
- type Text
- func (t Text) Column() string
- func (t Text) Database() Driver
- func (t Text) Decreasing() Sorter
- func (t Text) Equals(val string) Condition
- func (t Text) FieldName() string
- func (t *Text) Has(word string) Condition
- func (t Text) Increasing() Sorter
- func (t *Text) Index(index int) bool
- func (t Text) Interface() interface{}
- func (t Text) Key() bool
- func (t *Text) Make(length int) interface{}
- func (t Text) MarshalJSON() ([]byte, error)
- func (t *Text) Master() bool
- func (t Text) NotEquals(val string) Condition
- func (t Text) Offset() uintptr
- func (t Text) On(other struct{ ... }) Linker
- func (t *Text) Pointer() interface{}
- func (t *Text) Search(query string) Condition
- func (t *Text) Set(to string)
- func (t *Text) Slice(index int) interface{}
- func (t Text) String() string
- func (t Text) Table() string
- func (t Text) Test(ctx *testing.T)
- func (t *Text) To(new string) Update
- func (t Text) Type() reflect.Type
- func (t Text) Value() string
- type Time
- func (t Time) Column() string
- func (t Time) Database() Driver
- func (t Time) Decreasing() Sorter
- func (t Time) Equals(val time.Time) Condition
- func (t Time) FieldName() string
- func (t Time) Increasing() Sorter
- func (t *Time) Index(index int) bool
- func (t Time) Interface() interface{}
- func (t Time) Key() bool
- func (t *Time) Make(length int) interface{}
- func (t Time) MarshalJSON() ([]byte, error)
- func (t *Time) Master() bool
- func (t Time) NotEquals(val time.Time) Condition
- func (t Time) Offset() uintptr
- func (t Time) On(other struct{ ... }) Linker
- func (t *Time) Pointer() interface{}
- func (t *Time) Set(val time.Time)
- func (t *Time) Slice(index int) interface{}
- func (t Time) String() string
- func (t Time) Table() string
- func (t Time) Test(ctx *testing.T)
- func (t Time) To(val time.Time) Update
- func (t Time) Type() reflect.Type
- func (t Time) Value() time.Time
- type UUID
- func (t UUID) Column() string
- func (t UUID) Database() Driver
- func (t UUID) Decreasing() Sorter
- func (t UUID) Equals(val uid) Condition
- func (t UUID) FieldName() string
- func (t UUID) Increasing() Sorter
- func (t *UUID) Index(index int) bool
- func (t UUID) Interface() interface{}
- func (t UUID) Key() bool
- func (t *UUID) Make(length int) interface{}
- func (t UUID) MarshalJSON() ([]byte, error)
- func (t *UUID) Master() bool
- func (t UUID) NotEquals(val uid) Condition
- func (t UUID) Offset() uintptr
- func (t UUID) On(other struct{ ... }) Linker
- func (t *UUID) Pointer() interface{}
- func (t *UUID) Set(val uid)
- func (t *UUID) Slice(index int) interface{}
- func (t UUID) String() string
- func (t UUID) Table() string
- func (t UUID) Test(ctx *testing.T)
- func (t UUID) To(val uid) Update
- func (t UUID) Type() reflect.Type
- func (t UUID) Value() uid
- type Update
- type Variable
- type View
- type Viewable
- type Viewer
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var False = Condition{Operator: OpFalse}
var True = Condition{}
Functions ¶
func Delete ¶
Delete removes the viewer's table from the database. The master viewer must be passed to this function.
Types ¶
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
types.go2:13
func (Bool) Decreasing ¶
func (t Bool) Decreasing() Sorter
func (Bool) Increasing ¶
func (t Bool) Increasing() Sorter
func (Bool) MarshalJSON ¶
type Builtin ¶
type Builtin string
Builtin is a builtin database.
func (Builtin) Connect ¶
Connect connects the given viewer to view this database. It then returns the database.
type Bytes ¶
type Bytes struct {
// contains filtered or unexported fields
}
types.go2:13
func (Bytes) Decreasing ¶
func (t Bytes) Decreasing() Sorter
func (Bytes) Increasing ¶
func (t Bytes) Increasing() Sorter
func (Bytes) MarshalJSON ¶
type Column ¶
type Column interface { Column() string Database() Driver Type() reflect.Type Offset() uintptr Key() bool }
Column is the definition of a column.
type Condition ¶
type Condition struct {
Table, Column string
Operator
Value interface{}
View Table
//If any of the cases match, this condition evaluates to true.
Cases []Condition
Invert bool
// contains filtered or unexported fields
}
Condition can be used to specify a filter.
type Dictionary ¶
type Dictionary interface { //IndexWords returns related concept-indicies for the given words. //The indicies should be constant (for a given word within a given dictionary) //and unique to the concept that the word represents. //prime multiples can represent sub-concepts, ie animal = 3, dog = 6. //prime combinations can represent intersecting concepts. //meaningless words should be set to 1. //words that are used at a higher frequency should return lower numbers. //Words without dictionary entries should return 0. LookupWords(results []int64, words ...string) error }
Dictionary is required for efficient natural-language search. How you setup/store the dictionary is up to you. But DictionaryMap & DictionaryViewer implementations are provided by this package.
type DictionaryMap ¶
DictionaryMap implements a map-backed Dictionary.
func (*DictionaryMap) Add ¶
func (d *DictionaryMap) Add(words ...string)
Add adds a word to the dictionary.
func (*DictionaryMap) AddSynonym ¶
func (d *DictionaryMap) AddSynonym(synonym string, of string)
AddSynonym adds a synonym to the dictionary.
func (*DictionaryMap) LookupWords ¶
func (d *DictionaryMap) LookupWords(results []int64, words ...string) error
LookupWords implements Dictionary.LookupWords
type Driver ¶
type Driver interface { //Connect connects the given viewers to view this database. //It then returns the database. Connect(Viewer, ...Viewer) Driver //Sync syncs the Tables with the Database, adding any missing columns. //If constraints or types do not match up, an error is returned. Sync(Table, ...Table) error //Insert inserts the given row into the database. Insert(Row, ...Row) error //Delete deletes the given tables. Delete(Table, ...Table) error //Empty removes all rows from the given tables so that they are empty. Empty(Table, ...Table) error //Search returns results for the given filter. Search(Filter) Results //Close closes the connection to the database. Close() error }
Driver is a database driver.
type Error ¶
type Error string
Error is a database error.
const ErrDisconnectedViewer Error = "disconnected viewer"
ErrDisconnectedViewer means that an disconnected viewer was used, connect the viewer to a database to resolve this error.
const ErrDuplicateKey Error = "duplicate key"
ErrDuplicateKey means that a value tried to be inserted into the database but it failed due to having a duplicate value.
const ErrIllegalMaster Error = "illegal use of master viewer"
ErrIllegalMaster means that an attempt was made to write to a master viewer, assign the viewer to a variable to resolve this error.
const ErrMasterProtected Error = "this operation must be performed on a master viewer"
ErrMasterProtected means that an attempt was made to peform an operation on a clone of master. The operation was blocked for data-protection purposes. If you meant to perform this operation, pass a master viewer.
const ErrNotFound Error = "row not found"
ErrNotFound is returned if no row is found when getting from the database.
const ErrTableNotFound Error = "table not found"
ErrTableNotFound means that the operation failed because the viewer's table was not found. Check that the name of the table is correct, or create it with Sync()
const ErrUnregisteredViewer Error = "unregistered viewer"
ErrUnregisteredViewer means that an unregistered viewer was used, register the viewer to resolve this error.
type Expression ¶
type Expression struct {
Table, Column string
Operator
Value interface{}
View Table
// contains filtered or unexported fields
}
Expression containing a column.
type Filter ¶
type Filter struct { Table string View Table Condition Condition Conditions []Condition Sort Sorter Sorts []Sorter Link Linker Links []Linker Offset, Length int Columns []Variable // contains filtered or unexported fields }
Filter describes which rows to select in a database.
func (Filter) Average ¶
Average sets the variable to the average value of all results of that column.
func (Filter) MarshalJSON ¶
MarshalJSON encodes the results of the filter into JSON.
type Float32 ¶
type Float32 struct {
// contains filtered or unexported fields
}
types.go2:13
func (Float32) Decreasing ¶
func (t Float32) Decreasing() Sorter
func (Float32) Increasing ¶
func (t Float32) Increasing() Sorter
func (Float32) MarshalJSON ¶
type Float64 ¶
type Float64 struct {
// contains filtered or unexported fields
}
types.go2:13
func (Float64) Decreasing ¶
func (t Float64) Decreasing() Sorter
func (Float64) Increasing ¶
func (t Float64) Increasing() Sorter
func (Float64) MarshalJSON ¶
type Int16 ¶
type Int16 struct {
// contains filtered or unexported fields
}
types.go2:13
func (Int16) Decreasing ¶
func (t Int16) Decreasing() Sorter
func (Int16) Increasing ¶
func (t Int16) Increasing() Sorter
func (Int16) MarshalJSON ¶
type Int32 ¶
type Int32 struct {
// contains filtered or unexported fields
}
types.go2:13
func (Int32) Decreasing ¶
func (t Int32) Decreasing() Sorter
func (Int32) Increasing ¶
func (t Int32) Increasing() Sorter
func (Int32) MarshalJSON ¶
type Int64 ¶
type Int64 struct {
// contains filtered or unexported fields
}
types.go2:13
func (Int64) Decreasing ¶
func (t Int64) Decreasing() Sorter
func (Int64) DivisibleBy ¶
DivisibleBy returns a condition that is true if i is divisible by val.
func (Int64) Increasing ¶
func (t Int64) Increasing() Sorter
func (Int64) MarshalJSON ¶
type Int8 ¶
type Int8 struct {
// contains filtered or unexported fields
}
types.go2:13
func (Int8) Decreasing ¶
func (t Int8) Decreasing() Sorter
func (Int8) Increasing ¶
func (t Int8) Increasing() Sorter
func (Int8) MarshalJSON ¶
type LinkablesViewer ¶
LinkablesViewer can be used to view the 'linkable' table.
type Results ¶
type Results interface { json.Marshaler //Update updates the results with the given updates. //Returns the number of results updated (or -1 if the statistic is unavailable). Update(Update, ...Update) (int, error) //Delete deletes all the results from the database. Delete() (int, error) //Get gets the matching columns of the results. Get(Variable, ...Variable) (int, error) //Count returns the number of results. Count(Viewable) (int, error) //Sum returns the sum amount of the value in the given column of all results. Sum(Variable) error //Average returns the average value in the given column for all results. Average(Viewable) (float64, error) }
Results of a searchfilter.
type Slicer ¶
type Slicer Filter
Slicer is returned by Filter.Slice
func (Slicer) MarshalJSON ¶
MarshalJSON implements json.Marshaler
type String ¶
type String struct {
// contains filtered or unexported fields
}
types.go2:13
func (String) Decreasing ¶
func (t String) Decreasing() Sorter
func (String) Increasing ¶
func (t String) Increasing() Sorter
func (String) MarshalJSON ¶
type TestSuite ¶
type TestSuite struct { test.Suite Driver Testable TestablesViewer Linkable LinkablesViewer }
TestSuite that can be applied to drivers to test for consistency. It uses the 'testable' table and as long as this table is not in use, the tests are isolated from the rest of the database. If the test passes, then there will be no trace of the test-data in the database. This makes it safe to use on databases that are in use.
func (*TestSuite) SetupSuite ¶
func (ts *TestSuite) SetupSuite()
SetupSuite gets called before any of the tests are run. Connecting the test tables.
func (*TestSuite) TestConnect ¶
func (ts *TestSuite) TestConnect()
TestConnect tests the driver view-connection functionality.
func (*TestSuite) TestDelete ¶
func (ts *TestSuite) TestDelete()
TestDelete tests that the driver is able to delete a table.
func (*TestSuite) TestEmpty ¶
func (ts *TestSuite) TestEmpty()
TestEmpty tests that the driver is able to empty a table.
func (*TestSuite) TestInsert ¶
func (ts *TestSuite) TestInsert()
TestInsert tests that the driver is able to insert records into the database.
func (*TestSuite) TestLink ¶
func (ts *TestSuite) TestLink()
TestLink tests that the driver can link two tables together for filtering.
func (*TestSuite) TestPrimaryKey ¶
func (ts *TestSuite) TestPrimaryKey()
TestPrimaryKey tests that the driver will reject duplicate values for a given primary key.
func (*TestSuite) TestResultsAverage ¶
func (ts *TestSuite) TestResultsAverage()
TestResultsAverage tests the result average function.
func (*TestSuite) TestResultsCount ¶
func (ts *TestSuite) TestResultsCount()
TestResultsCount tests the results counting function.
func (*TestSuite) TestResultsDelete ¶
func (ts *TestSuite) TestResultsDelete()
TestResultsDelete tests the deletion of rows.
func (*TestSuite) TestResultsGet ¶
func (ts *TestSuite) TestResultsGet()
TestResultsGet tests the retrieval of rows.
func (*TestSuite) TestResultsJSON ¶
func (ts *TestSuite) TestResultsJSON()
TestResultsJSON tests the json marshalling of rows.
func (*TestSuite) TestResultsNotFound ¶
func (ts *TestSuite) TestResultsNotFound()
TestResultsNotFound tests that ErrNotFound is returned if a record does not exist.
func (*TestSuite) TestResultsRead ¶
func (ts *TestSuite) TestResultsRead()
TestResultsRead tests the retrieval of given columns.
func (*TestSuite) TestResultsSlice ¶
func (ts *TestSuite) TestResultsSlice()
TestResultsSlice tests filter slicing.
func (*TestSuite) TestResultsSum ¶
func (ts *TestSuite) TestResultsSum()
TestResultsSum tests the result sum function.
func (*TestSuite) TestResultsUpdate ¶
func (ts *TestSuite) TestResultsUpdate()
TestResultsUpdate tests the updating of rows.
type TestablesViewer ¶
TestablesViewer can be used to view the 'testable' table.
type Text ¶
type Text struct { String //WordIndex is used to speed up search. WordIndex Int64 //Dictionary used for indexing. Dictionary Dictionary }
Text is searchable text.
func (Text) Decreasing ¶
func (t Text) Decreasing() Sorter
func (Text) Increasing ¶
func (t Text) Increasing() Sorter
func (Text) MarshalJSON ¶
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
types.go2:13
func (Time) Decreasing ¶
func (t Time) Decreasing() Sorter
func (Time) Increasing ¶
func (t Time) Increasing() Sorter
func (Time) MarshalJSON ¶
type UUID ¶
type UUID struct {
// contains filtered or unexported fields
}
types.go2:13
func (UUID) Decreasing ¶
func (t UUID) Decreasing() Sorter
func (UUID) Increasing ¶
func (t UUID) Increasing() Sorter
func (UUID) MarshalJSON ¶
type Update ¶
type Update struct {
Column, Table string
Value interface{}
Then *Update
// contains filtered or unexported fields
}
Update describes a modification to make to a row in the database.
type Variable ¶
type Variable interface { Viewable Pointer() interface{} Make(int) interface{} Index(int) bool Slice(int) interface{} Master() bool }
Variable is a variable value in the database.
type View ¶
type View struct {
// contains filtered or unexported fields
}
View is a type that implements Viewer & Row. Embed this in your models and tag it with the name of the table you would like to view. ie `db:"users"`