forked from slicebit/qb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclause.go
29 lines (25 loc) · 1.07 KB
/
clause.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
package qb
// Compiles is the standard interface for any compilable sql clause
// Compiling means to post process any sql clauses if needed such as escaping, putting placeholders, etc.
type Compiles interface {
// Build is the key function of any sql clause
// It returns sql as string and bindings as []interface{}
Build(dialect Dialect) (string, []interface{})
}
// Clause is the key interface for any sql clause
type Clause interface {
Compiles
// String returns the dialect agnostic sql clause and bindings.
// It returns :varname as placeholders instead of $n or ?.
//String() (string, []interface{})
}
// TableClause is the common interface for ddl generators such as Column(), PrimaryKey(), ForeignKey().Ref(), etc.
type TableClause interface {
// String takes the dialect and returns the ddl as an sql string
String(dialect Dialect) string
}
// Builder is the common interface for any statement builder in qb such as Insert(), Update(), Delete(), Select() query starters
type Builder interface {
// Build takes a dialect and returns a stmt
Build(dialect Dialect) *Stmt
}