Postgres refactor.
This commit is contained in:
parent
d00167cbba
commit
8519ccbdd0
57 changed files with 2451 additions and 598 deletions
36
internal/jet/serializer.go
Normal file
36
internal/jet/serializer.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package jet
|
||||
|
||||
type SerializeOption int
|
||||
|
||||
const (
|
||||
noWrap SerializeOption = iota
|
||||
)
|
||||
|
||||
type StatementType string
|
||||
|
||||
const (
|
||||
SelectStatementType StatementType = "SELECT"
|
||||
InsertStatementType StatementType = "INSERT"
|
||||
UpdateStatementType StatementType = "UPDATE"
|
||||
DeleteStatementType StatementType = "DELETE"
|
||||
SetStatementType StatementType = "SET"
|
||||
LockStatementType StatementType = "LOCK"
|
||||
)
|
||||
|
||||
type Serializer interface {
|
||||
serialize(statement StatementType, out *SqlBuilder, options ...SerializeOption) error
|
||||
}
|
||||
|
||||
func Serialize(exp Serializer, statementType StatementType, out *SqlBuilder, options ...SerializeOption) error {
|
||||
return exp.serialize(statementType, out, options...)
|
||||
}
|
||||
|
||||
func contains(options []SerializeOption, option SerializeOption) bool {
|
||||
for _, opt := range options {
|
||||
if opt == option {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue