cquill/dev

Types

Development mode configuration

pub type DevConfig {
  DevConfig(
    enabled: Bool,
    log_queries: Bool,
    log_params: Bool,
    slow_query_threshold_ms: Int,
    log_pool_stats: Bool,
    pool_stats_interval_ms: Int,
    mask_fields: List(String),
    mask_pattern: String,
    explain_queries: Bool,
  )
}

Constructors

  • DevConfig(
      enabled: Bool,
      log_queries: Bool,
      log_params: Bool,
      slow_query_threshold_ms: Int,
      log_pool_stats: Bool,
      pool_stats_interval_ms: Int,
      mask_fields: List(String),
      mask_pattern: String,
      explain_queries: Bool,
    )

    Arguments

    enabled

    Whether dev mode is enabled

    log_queries

    Log all queries

    log_params

    Include parameters in logs

    slow_query_threshold_ms

    Threshold for slow query warnings (milliseconds)

    log_pool_stats

    Log pool statistics periodically

    pool_stats_interval_ms

    Interval for pool stats logging (milliseconds)

    mask_fields

    Fields to mask in logs (passwords, tokens, etc.)

    mask_pattern

    Pattern to use for masking

    explain_queries

    Enable EXPLAIN query output (requires adapter support)

Error types for dev mode operations

pub type DevError {
  AlreadyEnabled
  NotEnabled
  TelemetryRequired
  DevModeNotRunning
}

Constructors

  • AlreadyEnabled

    Dev mode already enabled

  • NotEnabled

    Dev mode not enabled

  • TelemetryRequired

    Telemetry server not running

  • DevModeNotRunning

    Dev mode server not running

Pool statistics for monitoring

pub type PoolStats {
  PoolStats(
    pool_name: String,
    size: Int,
    in_use: Int,
    available: Int,
    waiting: Int,
    total_checkouts: Int,
    total_timeouts: Int,
  )
}

Constructors

  • PoolStats(
      pool_name: String,
      size: Int,
      in_use: Int,
      available: Int,
      waiting: Int,
      total_checkouts: Int,
      total_timeouts: Int,
    )

    Arguments

    pool_name

    Name of the pool

    size

    Total pool size

    in_use

    Currently in use

    available

    Available connections

    waiting

    Requests waiting for connection

    total_checkouts

    Total checkouts since start

    total_timeouts

    Total timeouts since start

Values

pub fn configure(config: DevConfig) -> Result(Nil, DevError)

Update configuration while dev mode is running

pub fn default_config() -> DevConfig

Create a default configuration

pub fn disable() -> Result(Nil, DevError)

Disable development mode

pub fn enable() -> Result(Nil, DevError)

Enable development mode with default configuration

pub fn enable_from_env() -> Result(Nil, DevError)

Enable dev mode from environment variable Call this at application startup to auto-enable if CQUILL_DEV=1

pub fn enable_with_config(
  config: DevConfig,
) -> Result(Nil, DevError)

Enable development mode with custom configuration

pub fn get_config() -> option.Option(DevConfig)

Get the current configuration (if enabled)

pub fn is_enabled() -> Bool

Check if development mode is enabled

pub fn log_pool_stats(stats: PoolStats) -> Nil

Log current pool statistics

pub fn minimal_config() -> DevConfig

Create a minimal configuration (queries only, no params)

pub fn pool_stats(
  pool_name pool_name: String,
  size size: Int,
  in_use in_use: Int,
  available available: Int,
  waiting waiting: Int,
  total_checkouts total_checkouts: Int,
  total_timeouts total_timeouts: Int,
) -> PoolStats

Create pool stats from values

pub fn stop() -> Nil

Stop the dev mode server completely

pub fn update_pool_stats(stats: PoolStats) -> Nil

Update pool statistics in dev mode server

pub fn verbose_config() -> DevConfig

Create a verbose configuration (all debugging enabled)

Search Document