-
Notifications
You must be signed in to change notification settings - Fork 6
/
builder.go
39 lines (35 loc) · 1.37 KB
/
builder.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package query
import "context"
// AliasResults is the special item to use for named aliases in the result set
const AliasResults = "aliases_"
// QueryBuilderI is the primary aid in creating cross-platform, portable queries to the database(s)
// The code-generated ORM classes call these functions to build a query. The query will eventually get
// sent to the database for processing, and then unpacked into one of the ORM generated objects. You generally
// will not call these functions directly, but rather will call the matching functions in each of the codegenerated
// ORM classes located in your project directory.
//
// If you are creating a database driver, you will implement these functions in the query builder that you
// provide.
type QueryBuilderI interface {
Join(n NodeI, condition NodeI)
Expand(n NodeI)
Condition(c NodeI)
Having(c NodeI)
OrderBy(nodes ...NodeI)
GroupBy(nodes ...NodeI)
Limit(maxRowCount int, offset int)
Select(nodes ...NodeI)
Distinct()
Alias(name string, n NodeI)
// Load terminates the builder, queries the database, and returns the results as an array of interfaces similar in structure to a json structure
Load() []map[string]interface{}
Delete()
Count(distinct bool, nodes ...NodeI) uint
Subquery() *SubqueryNode
Context() context.Context
LoadCursor() CursorI
}
type CursorI interface {
Next() map[string]interface{}
Close() error
}