rethinkdb-java icon indicating copy to clipboard operation
rethinkdb-java copied to clipboard

feat: WriteOperation POJO to store results of CRUDs

Open vinceh121 opened this issue 1 year ago • 0 comments

Reason for the change Issue #18 check box "TableOperation" Notably, the ability for applications to read the generated_keys attribute on inserts is essential.

Description Creates the WriteOperation and Change POJOs that contain results of the 4 CRUD commands. The issue specified a POJO also used for the result of the sync command, but as its schema is totally different, WriteOperation only works for CRUD commands.

Code examples

Connection con = r.connection().connect();

Map<String, Object> map = new HashMap<>();
map.put("value", Math.random());

Result<WriteOperation> res = r.table("test")
		.insert(map)
		.run(con, WriteOperation.class);
System.out.println(res.single());

WriteOperation{generatedKeys=[3ee14074-c36b-4ecb-b3f5-c8f2186eec73], changes=[], inserted=1, replaced=0, unchanged=0, deleted=0, skipped=0, errors=0, firstError=null, warnings=null}

Checklist

References Reference pages of the insert, update, delete and replace commands.

vinceh121 avatar Feb 16 '23 21:02 vinceh121