Skip to content

Offset and Limit not present in BaseQuery.String/ToSql #264

@film42

Description

@film42

I was writing some code that conditionally applies a LIMIT and OFFSET; and while testing ended up very confused because calling query.ToSring() or query.ToSql() did not apply my LIMIT and OFFSET. After grepping through the kallax code I realized that these aren't applied until the Store.Find method is executed:

go-kallax/store.go

Lines 385 to 392 in 6e31900

columns, builder := q.compile()
if offset := q.GetOffset(); offset > 0 {
builder = builder.Offset(offset)
}
if limit := q.GetLimit(); limit > 0 {
builder = builder.Limit(limit)
}

I was just wondering if these are supposed to be applied here, or if this should remain a concern of BaseQuery.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions