Current
export const PrimaryKey = flow(S.propertySignature, S.fromKey("id"))
isin: PrimaryKey(ISIN),
query(where("id", someIsin))
Desired
const PrimaryKeySymbol = Symbol.for("effect-app/PrimaryKey")
export const PrimaryKey = (key: string) => flow(S.annotate(PrimaryKeySymbol, key))
isin: PrimaryKey("isin")(ISIN)
query(where("isin", someIsin)) // this is already the result of not using `fromKey`
where the driver maps isin to id and back, if the underlying storage mechanism demands it, like CosmosDB.
aka probably don't convert for in memory/json, or in the future in any SQL driver - set the PrimaryKey in SQL.
Current
Desired
where the driver maps isin to id and back, if the underlying storage mechanism demands it, like CosmosDB.
aka probably don't convert for in memory/json, or in the future in any SQL driver - set the PrimaryKey in SQL.