WIP on execution / SQLite integration tests
This commit is contained in:
29
src/main/kotlin/Count.kt
Normal file
29
src/main/kotlin/Count.kt
Normal file
@@ -0,0 +1,29 @@
|
||||
package solutions.bitbadger.documents
|
||||
|
||||
import solutions.bitbadger.documents.query.Count
|
||||
import java.sql.Connection
|
||||
|
||||
/**
|
||||
* Functions to count documents
|
||||
*/
|
||||
object Count {
|
||||
|
||||
/**
|
||||
* Count all documents in the table
|
||||
*
|
||||
* @param tableName The name of the table in which documents should be counted
|
||||
* @param conn The connection over which documents should be counted
|
||||
* @return A count of the documents in the table
|
||||
*/
|
||||
fun all(tableName: String, conn: Connection) =
|
||||
conn.customScalar(Count.all(tableName), mapFunc = Results::toCount)
|
||||
|
||||
/**
|
||||
* Count all documents in the table
|
||||
*
|
||||
* @param tableName The name of the table in which documents should be counted
|
||||
* @return A count of the documents in the table
|
||||
*/
|
||||
fun all(tableName: String) =
|
||||
Configuration.dbConn().use { all(tableName, it) }
|
||||
}
|
||||
Reference in New Issue
Block a user