Add support for expression in OFFSET clause.

This commit is contained in:
go-jet 2024-02-13 14:01:13 +01:00
parent dab153a739
commit 255f4a8eaf
9 changed files with 113 additions and 23 deletions

View file

@ -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