mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-19 06:02:52 +00:00
# Which Problems Are Solved Add projects to the relational tables # How the Problems Are Solved - Define table migrations - Define and implement Project and Project Role repositories. - Provide projection handlers to populate the relational tables. # Additional Changes - Statement Builder now has a constructor which allows setting of a base query with arguments. - Certain operations, like Get, Update and Delete require the Primary Key to be set as conditions. However, this requires knowledge of the implementation and table definition. This PR proposes an additional condition for repositories: `PrimaryKeyCondition`. This gives clarity on the required IDs for these operations. - Added couple of helpers to the repository package, to allow more DRY code. - getOne / getMany: generic functions for query execution and scanning. - checkRestrictingColumns, checkPkCondition: simplify condition checking, instead of using ladders of conditionals. - Added a couple of helpers to the repository test package: - Transaction, savepoint and rollback helpers. - Create instance and organization helpers for objects that depend on them (like projects). # Additional Context - after https://github.com/zitadel/zitadel/pull/10809 - closes #10765
14 lines
937 B
Go
14 lines
937 B
Go
// Package repository implements the repositories defined in the domain package.
|
|
// The repositories are used by the domain package to access the database.
|
|
//
|
|
// Repository methods may require a minimal set of columns in the [database.Condition] to be passed.
|
|
// This is to ensure that the repository methods are used correctly and do not affect more rows than intended.
|
|
// For example:
|
|
// - The instance ID is almost always required to ensure that only rows of the correct instance are affected.
|
|
// - Update and Delete methods often require the columns from the primary key to ensure that only one row is affected.
|
|
// The required columns are checked during the call and an error is returned if they are not present.
|
|
|
|
// the inheritance.sql file is me(silvan) over-engineering table inheritance.
|
|
// I would create a user table which is inherited by human_user and machine_user and the same for objects like idps.
|
|
package repository
|