tRPCttRPC
Powered by
ippoI
tRPC•3y ago•
5 replies
ippo

Query tRPC the right way

If you use graphql, you can precisely query what you exactly need and avoid over fetching, so you can do something like this:
user {
  id
  username
  avatar
}

user {
  id
  username
  avatar
  email
  updatedAt
}
user {
  id
  username
  avatar
}

user {
  id
  username
  avatar
  email
  updatedAt
}


how would you do that in tRPC?
do you have to implement an interface like this?
getUser({
  select: ["id", "avatar", "username"],
  orderBy: "ASC"
})
getUser({
  select: ["id", "avatar", "username"],
  orderBy: "ASC"
})


and what is if you want to query related stuff, like the user and its pets and from the pets you just want the ids but in other cases the names and ids
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Right way to structure your code when using tRPC?
StivoSStivo / ❓-help
4y ago
trpc query help
saloodpeepoSsaloodpeepo / ❓-help
2y ago
Is there a way to alter the query key generated by trpc?
asliwinskiAasliwinski / ❓-help
3y ago