Let's say I have a simple user
table with the following columns: name
, id
, token
. I get these values from a server so whenever I get them I want to update it inside my local database.
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 put resolver, I check if the user
given from the server 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 (from the user I got from the local db) 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.
P.S. I asked this question over at the GitHub page but realized it may be more appropriate to have it here.