discord-questions.trpc.io/m/1103073447564820502

Preview meta tags from the discord-questions.trpc.io website.

Linked Hostnames

4

Thumbnail

Search Engine Appearance

Google

https://discord-questions.trpc.io/m/1103073447564820502

Best practices in naming and defining procedures when they don't fit into standard buckets? - tRPC

I am loving TRPC and its type safety, but I feel like I'm struggling with the naming of procedures. I'm pretty confused with why I need to fit my procedures into one of the 3 buckets: query, mutation, or subscription. For example, I have `items`. They can be queried, mutated and subscribed to. And maybe a few more things - items can be generated, created, pulled from a remote source, deleted, renamed, aliased, etc. But let's try to fit this into these prescribed buckets. I felt inclined to define `items` as a `publicProcedure` with all 3 verbs. But I have to choose only one, not all three. The api does not support chaining on multiple verbs. If I want to support all 3, I have to differentiate them as separate procedure definitions such as `getItems`, `updateItems`, and `subscribeToItems`... but then, what's the point of query/mutate/subscribe if I am already differentiating them as separate procedure names? Now the client api surface is weird: I wanted the client code to read: `client.items.query()`, or `client.items.mutate(...)` I'm fine with it if I can just have `client.getItems()` or `client.updateItems(...)` Instead I have redundancy in the naming: `client.getItems.query()`, `client.updateItems.mutate(...)` To make things more confusing, some procedures just don't fit into these buckets. I can have procedures which read nothing, write nothing, but perform some action like open a file in vscode. None of the above conventions work in this case. My expectation when using it was simply to have an execute call, and let the author decide their naming conventions. If there is nothing special about a query or mutation, why introduce weird things that mess with the naming conventions and don't work in every case?



Bing

Best practices in naming and defining procedures when they don't fit into standard buckets? - tRPC

https://discord-questions.trpc.io/m/1103073447564820502

I am loving TRPC and its type safety, but I feel like I'm struggling with the naming of procedures. I'm pretty confused with why I need to fit my procedures into one of the 3 buckets: query, mutation, or subscription. For example, I have `items`. They can be queried, mutated and subscribed to. And maybe a few more things - items can be generated, created, pulled from a remote source, deleted, renamed, aliased, etc. But let's try to fit this into these prescribed buckets. I felt inclined to define `items` as a `publicProcedure` with all 3 verbs. But I have to choose only one, not all three. The api does not support chaining on multiple verbs. If I want to support all 3, I have to differentiate them as separate procedure definitions such as `getItems`, `updateItems`, and `subscribeToItems`... but then, what's the point of query/mutate/subscribe if I am already differentiating them as separate procedure names? Now the client api surface is weird: I wanted the client code to read: `client.items.query()`, or `client.items.mutate(...)` I'm fine with it if I can just have `client.getItems()` or `client.updateItems(...)` Instead I have redundancy in the naming: `client.getItems.query()`, `client.updateItems.mutate(...)` To make things more confusing, some procedures just don't fit into these buckets. I can have procedures which read nothing, write nothing, but perform some action like open a file in vscode. None of the above conventions work in this case. My expectation when using it was simply to have an execute call, and let the author decide their naming conventions. If there is nothing special about a query or mutation, why introduce weird things that mess with the naming conventions and don't work in every case?



DuckDuckGo

https://discord-questions.trpc.io/m/1103073447564820502

Best practices in naming and defining procedures when they don't fit into standard buckets? - tRPC

I am loving TRPC and its type safety, but I feel like I'm struggling with the naming of procedures. I'm pretty confused with why I need to fit my procedures into one of the 3 buckets: query, mutation, or subscription. For example, I have `items`. They can be queried, mutated and subscribed to. And maybe a few more things - items can be generated, created, pulled from a remote source, deleted, renamed, aliased, etc. But let's try to fit this into these prescribed buckets. I felt inclined to define `items` as a `publicProcedure` with all 3 verbs. But I have to choose only one, not all three. The api does not support chaining on multiple verbs. If I want to support all 3, I have to differentiate them as separate procedure definitions such as `getItems`, `updateItems`, and `subscribeToItems`... but then, what's the point of query/mutate/subscribe if I am already differentiating them as separate procedure names? Now the client api surface is weird: I wanted the client code to read: `client.items.query()`, or `client.items.mutate(...)` I'm fine with it if I can just have `client.getItems()` or `client.updateItems(...)` Instead I have redundancy in the naming: `client.getItems.query()`, `client.updateItems.mutate(...)` To make things more confusing, some procedures just don't fit into these buckets. I can have procedures which read nothing, write nothing, but perform some action like open a file in vscode. None of the above conventions work in this case. My expectation when using it was simply to have an execute call, and let the author decide their naming conventions. If there is nothing special about a query or mutation, why introduce weird things that mess with the naming conventions and don't work in every case?

  • General Meta Tags

    6
    • title
      Best practices in naming and defining procedures when they don't fit into standard buckets? - tRPC
    • charset
      utf-8
    • viewport
      width=device-width, initial-scale=1
    • next-size-adjust
    • description
      I am loving TRPC and its type safety, but I feel like I'm struggling with the naming of procedures. I'm pretty confused with why I need to fit my procedures into one of the 3 buckets: query, mutation, or subscription. For example, I have `items`. They can be queried, mutated and subscribed to. And maybe a few more things - items can be generated, created, pulled from a remote source, deleted, renamed, aliased, etc. But let's try to fit this into these prescribed buckets. I felt inclined to define `items` as a `publicProcedure` with all 3 verbs. But I have to choose only one, not all three. The api does not support chaining on multiple verbs. If I want to support all 3, I have to differentiate them as separate procedure definitions such as `getItems`, `updateItems`, and `subscribeToItems`... but then, what's the point of query/mutate/subscribe if I am already differentiating them as separate procedure names? Now the client api surface is weird: I wanted the client code to read: `client.items.query()`, or `client.items.mutate(...)` I'm fine with it if I can just have `client.getItems()` or `client.updateItems(...)` Instead I have redundancy in the naming: `client.getItems.query()`, `client.updateItems.mutate(...)` To make things more confusing, some procedures just don't fit into these buckets. I can have procedures which read nothing, write nothing, but perform some action like open a file in vscode. None of the above conventions work in this case. My expectation when using it was simply to have an execute call, and let the author decide their naming conventions. If there is nothing special about a query or mutation, why introduce weird things that mess with the naming conventions and don't work in every case?
  • Open Graph Meta Tags

    3
    • og:title
      Best practices in naming and defining procedures when they don't fit into standard buckets? - tRPC
    • og:description
      I am loving TRPC and its type safety, but I feel like I'm struggling with the naming of procedures. I'm pretty confused with why I need to fit my procedures into one of the 3 buckets: query, mutation, or subscription. For example, I have `items`. They can be queried, mutated and subscribed to. And maybe a few more things - items can be generated, created, pulled from a remote source, deleted, renamed, aliased, etc. But let's try to fit this into these prescribed buckets. I felt inclined to define `items` as a `publicProcedure` with all 3 verbs. But I have to choose only one, not all three. The api does not support chaining on multiple verbs. If I want to support all 3, I have to differentiate them as separate procedure definitions such as `getItems`, `updateItems`, and `subscribeToItems`... but then, what's the point of query/mutate/subscribe if I am already differentiating them as separate procedure names? Now the client api surface is weird: I wanted the client code to read: `client.items.query()`, or `client.items.mutate(...)` I'm fine with it if I can just have `client.getItems()` or `client.updateItems(...)` Instead I have redundancy in the naming: `client.getItems.query()`, `client.updateItems.mutate(...)` To make things more confusing, some procedures just don't fit into these buckets. I can have procedures which read nothing, write nothing, but perform some action like open a file in vscode. None of the above conventions work in this case. My expectation when using it was simply to have an execute call, and let the author decide their naming conventions. If there is nothing special about a query or mutation, why introduce weird things that mess with the naming conventions and don't work in every case?
    • og:image
      https://discord-questions.trpc.io/og/post?id=1103073447564820502
  • Twitter Meta Tags

    4
    • twitter:card
      summary_large_image
    • twitter:title
      Best practices in naming and defining procedures when they don't fit into standard buckets? - tRPC
    • twitter:description
      I am loving TRPC and its type safety, but I feel like I'm struggling with the naming of procedures. I'm pretty confused with why I need to fit my procedures into one of the 3 buckets: query, mutation, or subscription. For example, I have `items`. They can be queried, mutated and subscribed to. And maybe a few more things - items can be generated, created, pulled from a remote source, deleted, renamed, aliased, etc. But let's try to fit this into these prescribed buckets. I felt inclined to define `items` as a `publicProcedure` with all 3 verbs. But I have to choose only one, not all three. The api does not support chaining on multiple verbs. If I want to support all 3, I have to differentiate them as separate procedure definitions such as `getItems`, `updateItems`, and `subscribeToItems`... but then, what's the point of query/mutate/subscribe if I am already differentiating them as separate procedure names? Now the client api surface is weird: I wanted the client code to read: `client.items.query()`, or `client.items.mutate(...)` I'm fine with it if I can just have `client.getItems()` or `client.updateItems(...)` Instead I have redundancy in the naming: `client.getItems.query()`, `client.updateItems.mutate(...)` To make things more confusing, some procedures just don't fit into these buckets. I can have procedures which read nothing, write nothing, but perform some action like open a file in vscode. None of the above conventions work in this case. My expectation when using it was simply to have an execute call, and let the author decide their naming conventions. If there is nothing special about a query or mutation, why introduce weird things that mess with the naming conventions and don't work in every case?
    • twitter:image
      https://discord-questions.trpc.io/og/post?id=1103073447564820502
  • Link Tags

    10
    • canonical
      https://discord-questions.trpc.io/m/1103073447564820502
    • icon
      https://cdn.answeroverflow.com/867764511159091230/6af104c7f0f39a12fcd55bd7bd28928f/icon.png
    • preload
      https://www.answeroverflow.com/_next/static/media/4f05ba3a6752a328-s.p.woff2
    • preload
      https://www.answeroverflow.com/_next/static/media/9cf9c6e84ed13b5e-s.p.woff2
    • preload
      /discord/2.png

Links

8