Nested array
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
use the 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
javascript JSON values like objects and arrays. Some dialects might simply return
the data as a JSON string.
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: