Add support for expression in OFFSET clause.
This commit is contained in:
parent
dab153a739
commit
255f4a8eaf
9 changed files with 113 additions and 23 deletions
|
|
@ -222,16 +222,18 @@ func (l *ClauseLimit) Serialize(statementType StatementType, out *SQLBuilder, op
|
|||
|
||||
// ClauseOffset struct
|
||||
type ClauseOffset struct {
|
||||
Count int64
|
||||
Count IntegerExpression
|
||||
}
|
||||
|
||||
// Serialize serializes clause into SQLBuilder
|
||||
func (o *ClauseOffset) Serialize(statementType StatementType, out *SQLBuilder, options ...SerializeOption) {
|
||||
if o.Count >= 0 {
|
||||
out.NewLine()
|
||||
out.WriteString("OFFSET")
|
||||
out.insertParametrizedArgument(o.Count)
|
||||
if is.Nil(o.Count) {
|
||||
return
|
||||
}
|
||||
|
||||
out.NewLine()
|
||||
out.WriteString("OFFSET")
|
||||
o.Count.serialize(statementType, out, options...)
|
||||
}
|
||||
|
||||
// ClauseFetch struct
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue