A connection to a named database on a PostegreSQL server.

Constructors

  • Creates a new DatabaseClient.

    Parameters

    • client: Client

      The pg Client instance

    Returns DatabaseClient

Methods

  • Configures roles and privileges for admin usage of a schema.

    Parameters

    • schema: Schema

      The schema where the permissions apply

    • adminRole: Role

      The role to which permission should be granted

    • admins: Role[]

      The roles to receive membership in the admin role

    Returns Promise<(Grant | DefaultPrivileges)[]>

    A Promise that resolves to the new grants and default privileges

  • Configures roles and privileges for read-only usage of a schema.

    Parameters

    • schema: Schema

      The schema where the permissions apply

    • readerRole: Role

      The role to which permission should be granted

    • readers: Role[]

      The roles to receive membership in the reader role

    Returns Promise<(Grant | DefaultPrivileges)[]>

    A Promise that resolves to the new grants and default privileges