You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say I have a simple user table with the following columns: name, id, token.
Sometimes token is given to me and in those cases update token. Other times token will be null and in those cases I just want to keep the existing value inside token.
One way I thought of was to make a put resolver. Inside the resolver, I check if the given user already has a value for token. If it doesn't, I do a get based on the user's id. If i get a user back, I grab the token and save that along with the new user info.
But won't that basically double the amount of time to insert? I was wondering if there was a quicker way.
The text was updated successfully, but these errors were encountered:
To get rid inserting the same values, maybe just store token in separate table token : user_id, token_value?
Create put resolver like in one-to-many example with custom performPut. And here you can insert token only when it is needed and use two hidden resolvers for simple user and token.
Let's say I have a simple
user
table with the following columns:name
,id
,token
.Sometimes
token
is given to me and in those cases updatetoken
. Other times token will be null and in those cases I just want to keep the existing value insidetoken
.One way I thought of was to make a put resolver. Inside the resolver, I check if the given
user
already has a value for token. If it doesn't, I do a get based on the user'sid
. If i get a user back, I grab the token and save that along with the newuser
info.But won't that basically double the amount of time to insert? I was wondering if there was a quicker way.
The text was updated successfully, but these errors were encountered: