Package com.io7m.cardant.database.postgres.internal

# Class CADatabase

java.lang.Object
com.io7m.cardant.database.postgres.internal.CADatabase

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

public final class CADatabase extends Object implements CADatabaseType
The default postgres server database implementation.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CADatabase(CADatabaseTelemetry inTelemetry, CAStrings inStrings, Clock inClock, com.zaxxer.hikari.HikariDataSource inDataSource, com.io7m.jmulticlose.core.CloseableCollectionType<CADatabaseException> inResources)`
  The default postgres server database implementation.

- ## Method Summary

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

  ### Methods inherited from class java.lang.Object

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

- ## Constructor Details

  - ### CADatabase

    public CADatabase(CADatabaseTelemetry inTelemetry, CAStrings inStrings, Clock inClock, com.zaxxer.hikari.HikariDataSource inDataSource, com.io7m.jmulticlose.core.CloseableCollectionType<CADatabaseException> inResources)
    The default postgres server database implementation.
    Parameters:
      `inTelemetry` - A telemetry
      `inStrings` - The string resources
      `inClock` - The clock
      `inDataSource` - A pooled data source
      `inResources` - The resources to be closed

- ## Method Details

  - ### close

    public void close() throws CADatabaseException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `CADatabaseType`
    Throws:
      `CADatabaseException`

  - ### tracer

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

  - ### openConnection

    public CADatabaseConnectionType openConnection(CADatabaseRole role) throws CADatabaseException
    Description copied from interface: `CADatabaseType`
    Open a database connection using the given role.
    Specified by:
      `openConnection` in interface `CADatabaseType`
    Parameters:
      `role` - The role
    Returns:
      A database connection
    Throws:
      `CADatabaseException` - 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`