DbSetup-kotlin / com.ninja_squad.dbsetup_kotlin / dbSetup

dbSetup

fun dbSetup(to: Destination, binderConfiguration: BinderConfiguration = DefaultBinderConfiguration.INSTANCE, configure: DbSetupBuilder.() -> Unit): DbSetup

Top-level function allowing to create a DbSetup by passing a destination and a lambda expression used to configure the operations that must be made.

Example usage:

val setup = dbSetup(to = DriverManagerDestination(url, user, password)) {
    deleteAllFrom("user", "country")
    insertInto("country") {
        ...
    }
    insertInto("user") {
        ...
    }
    sql(...)
}


Parameters

to - the destination of the DbSetup

binderConfiguration - a custom binder configuration. The default one is used if not specified

configure - the function used to configure the DbSetup

Return
the created DbSetup

Author
JB Nizet



fun dbSetup(to: DataSource, binderConfiguration: BinderConfiguration = DefaultBinderConfiguration.INSTANCE, configure: DbSetupBuilder.() -> Unit): DbSetup

Top-level function allowing to create a DbSetup by passing a DataSource and a lambda expression used to configure the operations that must be made.

Example usage:

val setup = dbSetup(to = dataSource) {
    deleteAllFrom("user", "country")
    insertInto("country") {
        ...
    }
    insertInto("user") {
        ...
    }
    sql(...)
}


Parameters

to - the destination of the DbSetup

binderConfiguration - a custom binder configuration. The default one is used if not specified

configure - the function used to configure the DbSetup

Return
the created DbSetup

Author
JB Nizet