CollegeDB Configuration
The callback to perform after the initialization
The result of the callback
import { collegedb, first } from 'collegedb'
const result = collegedb({
kv: env.KV,
shards: {
'db-primary': env.DB_PRIMARY, // Existing DB with data
'db-secondary': env.DB_SECONDARY // Another existing DB
},
strategy: 'hash'
}, async () => {
return await first('user-123', 'SELECT * FROM users WHERE id = ?', ['user-123']);
});
Initializes the configuration and then performs a callback once the configuration has finished initializing.