Skip to content
Functionplugin-kyselyv0.9.0Decorator

RegisterKyselyService

Registers the service under key, which is also its table name unless options.table gives another. Handlers read it from the plugin's services[key].

See also:KyselyService

RegisterKyselyService<TKey, TTable>(
    key: TKey,
    options?: KyselyServiceRegistrationOptions<TTable>
): <Ctor extends Constructor<KyselyServices[TKey] & { table: TTable }>>(
    ctor: Ctor
) => void
\@RegisterKyselyService('users', { table: 'app_users' })
export class UsersService extends KyselyService<'app_users'> {
  // Some code
}

TKey

TKey

TTable

The table that the service reads, defaulting to the key

TTable

The table that the service reads, defaulting to the key

key

key: TKey

Service key for registration and type-safe access