Documentation
¶
Index ¶
- Variables
- func AvailableEnvs() []string
- func Close() error
- func CloseNeo4j() error
- func ClosePostgres()
- func DBForEnv(env string) driver.Conn
- func Database() string
- func DatabaseForEnv(env string) (string, bool)
- func GetDZDPDB() string
- func GetPublisherDB() string
- func GetShredderDB() string
- func Load() error
- func LoadNeo4j() error
- func LoadPostgres() error
- func Neo4jSession(ctx context.Context) neo4j.Session
- func SetDZDPDB(db string)
- func SetDatabase(db string)
- func SetPublisherDB(db string)
- func SetShredderDB(db string)
- type CHConfig
- type PgConfig
Constants ¶
This section is empty.
Variables ¶
var DB driver.Conn
DB is the global ClickHouse connection pool (mainnet-beta)
var EmbedMigrations embed.FS
var EnvDBs map[string]driver.Conn
EnvDBs maps environment names to their ClickHouse connection pools. The mainnet-beta entry always points to DB.
var EnvDatabases map[string]string
EnvDatabases maps environment names to their ClickHouse database names.
var HealthDB driver.Conn
HealthDB is a separate single-connection pool used exclusively for health checks (/readyz). Keeping it isolated from the main pool prevents cache refresh storms from starving the readiness probe.
var Neo4jClient neo4j.Client
Neo4jClient is the global read-only Neo4j client
var Neo4jDatabase string
Neo4jDatabase is the configured database name
var PgPool *pgxpool.Pool
PgPool is the global PostgreSQL connection pool
var PublicQueryDB driver.Conn
PublicQueryDB is a ClickHouse connection pool that uses a dedicated read-only user for the AI agent, MCP server, and user-facing query endpoint. Configured via CLICKHOUSE_PUBLIC_QUERY_USERNAME / CLICKHOUSE_PUBLIC_QUERY_PASSWORD. Falls back to DB (main user) if those env vars are not set.
Functions ¶
func AvailableEnvs ¶
func AvailableEnvs() []string
AvailableEnvs returns the list of environments that have databases configured.
func DBForEnv ¶
DBForEnv returns the ClickHouse connection pool for the given environment. Falls back to the default DB if the environment is not configured.
func DatabaseForEnv ¶
DatabaseForEnv returns the database name for the given environment. Returns the database name and true if found, or empty string and false if not.
func GetPublisherDB ¶
func GetPublisherDB() string
GetPublisherDB returns the publisher database name.
func Load ¶
func Load() error
Load initializes configuration from environment variables and creates the connection pool
func LoadNeo4j ¶
func LoadNeo4j() error
LoadNeo4j initializes the Neo4j client from environment variables. The client is read-only to prevent accidental writes from the API layer.
func LoadPostgres ¶
func LoadPostgres() error
LoadPostgres initializes the PostgreSQL connection pool
func Neo4jSession ¶
Neo4jSession creates a new Neo4j session
func SetPublisherDB ¶
func SetPublisherDB(db string)
SetPublisherDB sets the publisher database name.