mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-25 12:01:39 +02:00
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:
@@ -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,
|
||||
|
Reference in New Issue
Block a user