English | 简体中文

api-docs / org.ktorm.global / invoke

invoke

inline operator fun <T> Database.invoke(
    func: Database.() -> T
): T
(source code)

Deprecated: ktorm-global will be removed in the future, please migrate to the standard API.

Execute the callback function using the current database instance.

Useful when we have many database instances. Call this function to choose one to execute
our database specific operations. While the callback functions are executing, the Database.Companion.global
property will be set to the current database. And after the callback completes, it’s automatically
restored to the origin one.

See Also

Database.Companion.global