Skip to content

Commit

Permalink
Add callback to hook into DatabaseConfiguration creation of NativeSql…
Browse files Browse the repository at this point in the history
…iteDriver (#3512)

Co-authored-by: Alec Strong <AlecStrong@users.noreply.github.com>
Co-authored-by: Philip Wedemann <22521688+hfhbd@users.noreply.github.com>
  • Loading branch information
3 people committed Sep 26, 2022
1 parent 6eb51f7 commit e76d605
Showing 1 changed file with 5 additions and 1 deletion.
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

0 comments on commit e76d605

Please sign in to comment.