db

package
v0.0.0-...-f2259ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package db provides database connection helpers for the Mote backend.

It reads the DATABASE_URL from the environment and exposes a Connect function that returns a ready-to-use pgx connection. Integration tests should call Connect directly; unit tests can use the pool from this package's test helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context) (*pgxpool.Pool, error)

Connect creates a new connection pool using MOTE_DATABASE_URL. The pool is configured with reasonable defaults for local development and will be closed when the provided context is cancelled.

func ConnectURL

func ConnectURL(ctx context.Context, url string) (*pgxpool.Pool, error)

ConnectURL creates a new connection pool for the given database URL.

func DefaultURL

func DefaultURL() (string, error)

DefaultURL returns the default database URL from the MOTE_DATABASE_URL environment variable. It returns a useful error if the variable is unset.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL