Skip to main content

Queries Overview

Ormed gives you three layers for data access: query builder, repositories, and DataSource orchestration.

Prerequisites

What You’ll Learn

  • When to use query builder vs repository vs DataSource APIs
  • A practical order for learning query features
  • How to scale from simple CRUD to multi-connection workflows

Step Outcome

By the end of this page, you should know which API layer to use first for your current task.

Query Layers

  • Query Builder: fluent typed reads and writes, joins, filters, projections.
  • Repository: model-oriented create/update/delete workflows.
  • DataSource: connection lifecycle, transactions, and multi-database routing.

Quick Decision Guide

  • Need custom filtering/joining/projections: start with Query Builder.
  • Need model-centric write flows (insert/update/delete): use Repository.
  • Need lifecycle/transactions/connection routing: use DataSource.
  1. Query Builder: core read/write fluency.
  2. Repository: structured model mutations.
  3. Loading Relations: association-aware reads.
  4. DataSource: boot, connection control, transactions.
  5. JSON Queries + Caching: specialized tuning.

Read This Next