Skip to content

Support idKey conversion in the storage driver, instead of requiring X.fromKey("id") #92

Description

@patroza

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.

No activity

Activity on this issue will appear here.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions