Given some base object (be it empty or the result of an Orm.map), hydrates all of the fields recursively
using the includeTree to determine which navigation properties to hydrate.
For KV and R2 fields, performs the necessary queries to Workers KV and R2 to retrieve the data, which is then attached to the base object.
Given some D1PreparedStatement that is expected to return multiple rows representing Models,
maps the results to the Models based on the provided metadata and include tree, and returns them as an array.
See Orm.map for details on how the mapping is performed, and Orm.hydrate for details on how hydration is performed.
Performs a SQL + KV upsert based on the provided metadata and include tree, returning the upserted model.
Recursively performs upserts for all nested navigation properties included in the includeTree.
The newModel parameter is a partial model object that specifies the new values to upsert, and serves as the basis for generating the upsert SQL query.
The SQL query will execute as an insert if:
newModelThe SQL query will execute as an insert OR update if:
newModelThe SQL query will execute as an update if:
newModel, but all primary key fields are provided with values.StaticfromStaticmapMaps a D1Result to a Cloesce Model based on the provided metadata and include tree.
Fails silently if a mapping cannot be performed for some row, skipping it in results.
Capable of mapping only queries returned from Orm.select, which are aliased in an Object Oriented fashion.
StaticselectA SQL SELECT query generator based on the provided metadata and include tree.
All navigation fields are LEFT JOINed to the result.
Aliases all fields of a Model in an Object Oriented fashion s.t. they can be referenced like:
[navigation.name], [navigation.nestedNavigation.name], etc. in the mapping function.
All top level columns of a Model are aliased by name:
[columnName].
Utilizes the provided includeTree to determine which navigation fields to LEFT JOIN and include in the result.
a SQL SELECT string that can be executed to retrieve the Model(s).
Given some
D1PreparedStatementthat is expected to return a single row representing a Model, maps the result to the Model based on the provided metadata and include tree, and returns it.See
Orm.mapfor details on how the mapping is performed, andOrm.hydratefor details on how hydration is performed.