Bun

interface

SQL.PostgresOrMySQLOptions

interface PostgresOrMySQLOptions

  • adapter?: 'postgres' | 'mysql' | 'mariadb'

    Database adapter/driver to use

  • bigint?: boolean

    By default values outside i32 range are returned as strings. If this is true, values outside i32 range are returned as BigInts.

  • connection?: Record<string, string | number | boolean>

    Postgres client runtime configuration options

  • connectionTimeout?: number

    Maximum time in seconds to wait when establishing a connection

  • database?: string

    Name of the database to connect to

  • host?: string

    Database server hostname

  • idleTimeout?: number

    Maximum time in seconds to wait for connection to become available

  • max?: number

    Maximum number of connections in the pool

  • maxLifetime?: number

    Maximum lifetime in seconds of a connection

  • onclose?: (err: null | Error) => void

    Callback executed when a connection is closed Receives the closing Error or null.

  • onconnect?: (err: null | Error) => void

    Callback executed when a connection attempt completes Receives an Error on failure, or null on success.

  • password?: string | () => MaybePromise<string>

    Database password for authentication

  • path?: string

    Unix domain socket path for connection

  • port?: string | number

    Database server port number

  • prepare?: boolean

    Automatic creation of prepared statements

  • ssl?: boolean | TLSOptions

    Whether to use TLS/SSL for the connection (alias for tls)

  • tls?: boolean | TLSOptions

    Whether to use TLS/SSL for the connection

  • url?: string | URL

    Connection URL (can be string or URL object)

  • username?: string

    Database user for authentication