Read-only DB

Adds a read-only database connection, with a separate configuration

Technology

The readonlydb module provides a separate read-only database connection for Project Forge applications. This enables read-heavy operations to be offloaded to a dedicated read replica or separate database instance, improving performance and reducing load on the primary database.

Overview

This module extends applications with database module enabled by adding:

Key Features

Performance Benefits

Configuration Flexibility

Database Support

Configuration Variables

The module provides comprehensive configuration through environment variables:

Connection Settings

Usage

Application Integration

When enabled, the read-only database connection is available through the application state:

1
2
3
4
5
// Access read-only database connection
readDB := as.Services.ReadDB

// Use for read operations
rows, err := readDB.Query("SELECT * FROM users WHERE active = true")

Best Practices

Dependencies

Source Code

See Also