# Class IdDatabase

java.lang.Object
com.io7m.idstore.database.postgres.internal.IdDatabase

All Implemented Interfaces:
  `IdDatabaseType, com.io7m.repetoir.core.RPServiceType, AutoCloseable`

public final class IdDatabase extends Object implements IdDatabaseType
The default postgres server database implementation.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IdDatabase(IdDatabaseTelemetry inTelemetry, IdDatabaseConfiguration inConfiguration, Clock inClock, com.zaxxer.hikari.HikariDataSource inDataSource, com.io7m.jmulticlose.core.CloseableCollectionType<IdDatabaseException> inResources)`
  The default postgres server database implementation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `IdDatabaseConfiguration`
  `configuration()`
  `String`
  `description()`
  `IdDatabaseConnectionType`
  `openConnection(IdDatabaseRole role)`
  Open a database connection using the given role.
  `String`
  `toString()`
  `io.opentelemetry.api.trace.Tracer`
  `tracer()`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### IdDatabase

    public IdDatabase(IdDatabaseTelemetry inTelemetry, IdDatabaseConfiguration inConfiguration, Clock inClock, com.zaxxer.hikari.HikariDataSource inDataSource, com.io7m.jmulticlose.core.CloseableCollectionType<IdDatabaseException> inResources)
    The default postgres server database implementation.
    Parameters:
      `inTelemetry` - A telemetry
      `inConfiguration` - The configuration
      `inClock` - The clock
      `inDataSource` - A pooled data source
      `inResources` - The resources to be closed

- ## Method Details

  - ### close

    public void close() throws IdDatabaseException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `IdDatabaseType`
    Throws:
      `IdDatabaseException`

  - ### configuration

    public IdDatabaseConfiguration configuration()
    Specified by:
      `configuration` in interface `IdDatabaseType`
    Returns:
      The configuration used to open the database

  - ### tracer

    public io.opentelemetry.api.trace.Tracer tracer()
    Returns:
      The OpenTelemetry tracer

  - ### openConnection

    public IdDatabaseConnectionType openConnection(IdDatabaseRole role) throws IdDatabaseException
    Description copied from interface: `IdDatabaseType`
    Open a database connection using the given role.
    Specified by:
      `openConnection` in interface `IdDatabaseType`
    Parameters:
      `role` - The role
    Returns:
      A database connection
    Throws:
      `IdDatabaseException` - On errors

  - ### description

    public String description()
    Specified by:
      `description` in interface `com.io7m.repetoir.core.RPServiceType`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`