Skip to content

Define public query and batch execution contract #20

Description

@piraz

Goal

Define the public query and batch-execution contract required by applications
that use github.com/candango/sqlok.

Context

The core currently exposes SQL AST/compiler pieces plus Mapper and Session
behavior, but application consumers still need a stable public way to execute
filtered lists, joins, aggregates, and batched relationship reads without
copying compiler or executor internals.

Scope

  • Define context-aware query execution over caller-owned *sql.DB and
    *sql.Tx boundaries.
  • Define row mapping and error behavior for list and empty-result queries.
  • Define batch loading/relationship patterns that avoid per-row query fan-out.
  • Keep compiler plans, bind buffers, and caches behind the public boundary.
  • Add contract tests and documentation before implementation expands.

Non-goals

  • Do not mention or depend on a specific downstream application.
  • Do not add a global cache or hide transaction ownership.
  • Do not import database drivers into the core.

Acceptance criteria

  • Public API shape and ownership rules are documented.
  • List, empty-result, transaction, mapping-error, and batch-query cases have
    executable contract tests.
  • The design preserves driver-agnostic execution and leaves dialect-specific
    behavior to dialects/adapters.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions