Skip to content

feat(orm): support explicit composite repository keys #503

Description

@GaspardKirira

Summary

Add repository operations for tables whose identity consists of multiple columns.

Current behavior

Repository identity is represented by one column and one bound value.

Tables with composite keys require complete custom repository implementations.

Expected behavior

Repositories must support an explicit ordered key made of validated column/value pairs.

Existing single-column behavior must remain the default.

Scope

  • Define a composite key representation.
  • Preserve key column order.
  • Validate key identifiers.
  • Reject empty composite keys.
  • Support find operations.
  • Support existence checks.
  • Support updates.
  • Support deletion.
  • Bind all key values.
  • Add SQLite integration tests.
  • Preserve single-column APIs.

Suggested files

  • modules/orm/include/vix/orm/Key.hpp
  • modules/orm/include/vix/orm/Repository.hpp
  • modules/orm/tests/composite_key_test.cpp

Acceptance criteria

  • Two-column keys work.
  • Three-column keys work.
  • Key ordering is deterministic.
  • Empty keys are rejected.
  • Every value uses prepared-statement binding.
  • Existing single-column repositories remain compatible.
  • SQLite integration tests pass.

Non-goals

This issue does not include:

  • automatic key discovery;
  • generated composite identifiers;
  • relationship foreign keys;
  • ORM schema generation.

Suggested labels

  • scope:orm
  • type:feature
  • tests
  • help wanted
  • status:accepted

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions