# RegisterKyselyService

`function` in `plugin-kysely-postgres` · v0.3.0

<https://docs.seedcord.org/packages/plugin-kysely-postgres/0.3.0/functions/register-kysely-service>

Registers a Kysely Postgres service with the specified key and options.

Associates a service class with a key for dependency injection. The service becomes available via `core.db.services[key]`.

```ts
RegisterKyselyService<TKey, TTable>(
    key: TKey,
    options?: KyselyServiceRegistrationOptions<TTable>
): <Ctor extends Constructor<KyselyServices[TKey] & { table: TTable }>>(
    ctor: Ctor
) => void
```

Registers a Kysely Postgres service with the specified key and options.

Associates a service class with a key for dependency injection. The service becomes available via `core.db.services[key]`.

Parameters.

- `key` `TKey` — Service key for registration and type-safe access
- `options?` `KyselyServiceRegistrationOptions<TTable>`

Returns `<Ctor extends Constructor<KyselyServices[TKey] & { table: TTable; }>>(ctor: Ctor) => void`.
