While kysely is not an ORM and it doesn't have the concept of relations, we do provide
helpers for fetching nested objects and arrays in a single query. In this example we
jsonArrayFrom helper to fetch person's pets along with the person's id.
Please keep in mind that the helpers under the
kysely/helpers folder, including
jsonArrayFrom, are not guaranteed to work with third party dialects. In order for
them to work, the dialect must automatically parse the
json data type into
the data as a JSON string. In these cases you can use the built in
to parse the results.
The API documentation is packed with examples. The API docs are hosted here but you can access the same documentation by hovering over functions/methods/classes in your IDE. The examples are always just one hover away!
For example, check out these sections: