Skip to main content

Usage

db-common is a collection of small, focused database helpers. Import only the ones you need — everything is tree-shakeable.

import { paginate } from '@rtorcato/db-common'

const { limit, offset } = paginate({ page: 3, size: 20 })
// → { limit: 20, offset: 40 }
Growing API

The public surface is intentionally small while the library stabilises. New helpers are documented here as they land — track progress on the milestones.

Conventions

Helpers in db-common follow the same contract as the rest of the @rtorcato/* family:

  • Pure where possible — given the same input, return the same output; no hidden global state.
  • Predictable shapes — return plain objects/values you can destructure, not driver-specific wrappers.
  • No surprise throws — the common path returns a value; invalid input is reported, not thrown from deep inside.

See the Changelog for what's shipped in each release.