Database Interaction Strategies
SoapJS gives you several ways to query — from simple typed conditions to raw native queries. Pick the lightest one that expresses your need:
Advanced Query Composition with the Where Builder Introduction: Compose type-safe, storage-agnostic conditions (
valueOf().isEq(),and/or,brackets) inside typed repository methods. Your default for most queries.Reusable Queries with RepositoryQuery Introduction: Wrap complex or reused queries in named
RepositoryQueryobjects whosebuild()returns portableFindParams— query logic as first-class, testable units.Dedicated Repository Methods Introduction: Expose intent-revealing methods (
findThreats()) on the repository, keeping call sites clean and the query in one place.Native Queries Introduction: For queries the abstraction can't express (aggregations, vendor operators, raw SQL), drop to
Source.native()— kept named and quarantined in aRepositoryQuery, never smuggled through casts.
The progression goes composed conditions → reusable query objects → repository abstraction → raw native execution: increasing power, decreasing portability.
Last updated