Trpc & non-consistent JSON Field Attributes in MySQL
Just getting used to trpc & the t3 stack.
Say I have a standard procedure:
Now what I am interested in is the
content
attribute. In my mysql schema, that content
field is a JSON field. Depending on the type
field, it will contain different values.
For example. If type
is blogPost
, it will contain attributes like title
& category
, but if the type
is set to landingPage
those attributes will change. (just an example to make it more straightforward, my use case isn't about blogPosts etc.)
Now trpc expects me to tell it what the object looks like: e.g.: there is a title, which is a string. But what if my landingPage
type looks totally different, and, say, doesn't have a title
?1 Reply
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View