Types
EmbeddedPostgres = object
GreskewelConfigError = object of CatchableError
PostgresConfig = ref object port*: Port = 5432'u basePath*: string cachePath*: string = "cache" runtimePath*: string = "runtime" dataPath*: string = "data" binariesPath*: string = "bin"
PostgresVersion = enum v18 = "18.0.0", v17 = "17.5.0", v16 = "16.9.0", v15 = "15.13.0", v14 = "14.18.0", v13 = "13.21.0"
Consts
getCurrentOS = "linux"
Procs
proc dispose(ep: var EmbeddedPostgres) {....raises: [OSError], tags: [ReadDirEffect, WriteDirEffect], forbids: [].}
- Dispose of the data directory and any resources used by the embedded Postgres server.
proc downloadBinaries(ep: var EmbeddedPostgres) {. ...raises: [GreskewelConfigError, OSError, IOError, ValueError], tags: [ WriteDirEffect, ReadDirEffect, ExecIOEffect, ReadIOEffect, RootEffect], forbids: [].}
- Download the Postgres binaries for the specified version and store them in the configured path.
proc getConfig(ep: EmbeddedPostgres): PostgresConfig {....raises: [], tags: [], forbids: [].}
- Get the configuration of the embedded Postgres server
proc getConnectionString(ep: EmbeddedPostgres): string {....raises: [], tags: [], forbids: [].}
- Get the connection string for the embedded Postgres server
proc getVersion(ep: EmbeddedPostgres): PostgresVersion {....raises: [], tags: [], forbids: [].}
- Get the version of the embedded Postgres server
proc init(ep: var EmbeddedPostgres) {....raises: [GreskewelConfigError, OSError, IOError], tags: [WriteDirEffect, ReadDirEffect, ExecIOEffect, ReadIOEffect, RootEffect], forbids: [].}
- Initialize the embedded Postgres server with the specified configuration.
proc initEmbeddedPostgres(config: PostgresConfig = nil; version: PostgresVersion = PostgresVersion.v16): EmbeddedPostgres {. ...raises: [], tags: [], forbids: [].}
- Initializes the embedded Postgres server with the specified configuration. If no configuration is provided, it uses the default configuration for the specified version.
proc isRunning(ep: EmbeddedPostgres): bool {....raises: [], tags: [], forbids: [].}
- Check if the embedded Postgres server is running
proc restart(ep: var EmbeddedPostgres) {....raises: [ResourceExhaustedError], tags: [RootEffect, TimeEffect], forbids: [].}
- Restart the embedded Postgres server
proc start(ep: var EmbeddedPostgres) {....raises: [ResourceExhaustedError], tags: [TimeEffect, RootEffect], forbids: [].}
- Start the embedded Postgres server
proc status(ep: EmbeddedPostgres): string {....raises: [], tags: [], forbids: [].}
- Get the status of the embedded Postgres server
proc stop(ep: var EmbeddedPostgres) {....raises: [], tags: [RootEffect, TimeEffect], forbids: [].}
- Stop the embedded Postgres server