ippoI
tRPC3y 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
}


how would you do that in tRPC?
do you have to implement an interface like this?
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
Was this page helpful?