CRUD
This topic describes how to perform CRUD operations with your generated Teo
frontend client. CRUD is an acronym that stands for:
Refer to the Teo Client API reference documentation for detailed explanations
of each method.
Example server
All examples are based on the following server schema definition:
Use the teo generate client
command to generate the TypeScript library and
navigate to it.
Create
Create a single record
The following query creates a single artist with two fields:
Hide HTTP response
Create multiple records
The following createMany
query creates multiple artists.
Hide HTTP response
Create nested records
The following createMany
query create an artist with related songs.
Hide HTTP response
Read
Get record by ID or unique identifier
The following queries return a single record by unique identifier or ID:
Hide HTTP response
Get matched records
The following query return filtered records. Without filtering and pagination
arguments, findMany
returns all records.
Hide HTTP response
Get the first matched record
The following query returns the first matched record.
Hide HTTP response
Update
Update a single record
The following query updates a matched record.
Hide HTTP response
Update multiple records
The following query updates 0 or more matched records.
Hide HTTP response
Update or create a record
The following query updates matched unique record if it exists otherwise create
a new one.
Hide HTTP response
Atomic updation
A number field can be updated with atomic updator.
Hide HTTP response
Connect and disconnect records
The following query connects records.
Hide HTTP response
The following query disconnects records.
Hide HTTP response
Delete
Delete a single record
This query deletes a single record.
Hide HTTP response
Delete multiple records
This query deletes matched records. Without filtering and pagination arguments,
deleteMany
deletes all records.
Hide HTTP response