gom: Clean up gom-resource.h
gom: Fix has_primary_key() return value

The has_primary_key() function was actually returning FALSE if the
resource had a primary set, the opposite of what we expected.
gom: Track whether GomResource objects come from the DB

We now track whether objects come from the database
(GomResourceGroup's fetch will tag items as such when getting them),
so that we can assert whether saves on that object would be an insert or
an update.

We also track the primary key changing back to zero/null, so that
something like getting an item from the DB, resetting the ID, and saving
it will create a duplicate as intended.

This fixes the failing test case introduced in
8e5602fa15fee310919a2ef087bc4726d4891f00