Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add callback to hook into DatabaseConfiguration creation of NativeSqliteDriver #3512

Merged
merged 4 commits into from Sep 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -112,10 +112,14 @@ class NativeSqliteDriver(
maxReaderConnections = maxReaderConnections,
)

/**
* @param onConfiguration Callback to hook into [DatabaseConfiguration] creation.
*/
constructor(
schema: SqlSchema,
name: String,
maxReaderConnections: Int = 1,
onConfiguration: (DatabaseConfiguration) -> DatabaseConfiguration = { it },
) : this(
configuration = DatabaseConfiguration(
name = name,
Expand All @@ -126,7 +130,7 @@ class NativeSqliteDriver(
upgrade = { connection, oldVersion, newVersion ->
wrapConnection(connection) { schema.migrate(it, oldVersion, newVersion) }
},
),
).let(onConfiguration),
maxReaderConnections = maxReaderConnections,
)

Expand Down