config+sqldb: make native SQL query config options configurable

Here, we make the sql query option params (batch size and pagination
size) configurable. The defaults for SQLite vs Postgres are still the
same but will be changed in an upcoming commit.
This commit is contained in:
Elle Mouton
2025-08-11 11:17:17 +02:00
parent 75691163a9
commit ee292786b1
5 changed files with 34 additions and 6 deletions

View File

@@ -6,20 +6,19 @@ import (
)
// QueryConfig holds configuration values for SQL queries.
//
//nolint:ll
type QueryConfig struct {
// MaxBatchSize is the maximum number of items included in a batch
// query IN clauses list.
MaxBatchSize int
MaxBatchSize int `long:"max-batch-size" description:"The maximum number of items to include in a batch query IN clause. This is used for queries that fetch results based on a list of identifiers."`
// MaxPageSize is the maximum number of items returned in a single page
// of results. This is used for paginated queries.
MaxPageSize int32
MaxPageSize int32 `long:"max-page-size" description:"The maximum number of items to return in a single page of results. This is used for paginated queries."`
}
// DefaultQueryConfig returns a default configuration for SQL queries.
//
// TODO(elle): make configurable & have different defaults for SQLite and
// Postgres.
func DefaultQueryConfig() *QueryConfig {
return &QueryConfig{
MaxBatchSize: 250,