anchor.diff:      [jsx:encode(array_to_erl_json(X)) || {{array, X}} <- Results].
   
   %% Find document with given Id, assumes Id is unique
  --spec lookup(Table::binary(), Id :: binary()) -> jsx:json_text().
  +-spec lookup(Table::binary(), Id :: binary()) -> jsx:json_text() | {error, no_doc}.
   lookup(Table, Id)
     when is_binary(Table),
          is_binary(Id) ->
  -    {{select, _Rows}, [{{array, Results}}]} =
  -        dikdik_db:extended_query(<<"SELECT %% hstore(data) FROM ", Table/binary,
  -                                   " WHERE id=$1">>, [Id]),
  -    jsx:encode(array_to_erl_json(Results)).
  +    case dikdik_db:extended_query(<<"SELECT %% hstore(data) FROM ", Table/binary,
  +                                    " WHERE id=$1">>, [Id]) of
  +        {{select, _Rows}, [{{array, Results}}]} ->            
  +            jsx:encode(array_to_erl_json(Results));
  +        {{select, 0}, []} ->
  +            {error, no_doc}
  +    end.    
   
   %% Create new document with Name, assumes Name does not currently exist
   -spec insert(Table::binary(), Doc::jsx:json_text()) -> ok | {error, Error::binary()}.
  
positive.code:        is_binary(Id),
         is_binary(Doc) ->
      Values = to_insert_vals(Doc),
      {{insert, _}, _} =
          dikdik_db:simple_query(<<"INSERT INTO ", Table/binary," (id, data) VALUES ('", Id/binary, "','", Values/binary,"')">>).
  
  %% Replace an already existing document at Id with new document
  
negative.code:   when is_binary(Table),
         is_binary(Doc) ->
      Values = to_insert_vals(Doc),
      {{insert, _, _}, _} = 
          dikdik_db:simple_query(<<"INSERT INTO ", Table/binary," (id, data) VALUES (uuid_generate_v4(), '",Values/binary,"')">>).
  
  -spec insert(Table::binary(), Id::binary(), Doc::jsx:json_text()) -> ok | {error, Error::binary()}.
  