I would like to use an user entered string as the unique Key for an Entity. Suppose an user enters a key that is already in the datastore, I would like to return an error. Since the golang datastore API only has Put which also doubles as Insert, what is the best way to enforce uniqueness constraint?
Currently I'm trying to do…
Query(T).Filter("Key =", key)
…where key is constructed from the user entered value to test the existence of a duplicate, but 2 identical keys seem to return false with the equality (=) operator in the filter but true when calling Equal on the result.
How do I query by Key?