using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace RethinkDb.Driver.Model
{
///
/// A typed helper for reading response meta data.
///
public class Result
{
///
/// A list of generated primary keys for inserted documents whose primary keys were not specified (capped to 100,000).
///
[JsonProperty("generated_keys")]
public Guid[] GeneratedKeys { get; set; }
///
/// The number of documents successfully inserted.
///
public ulong Inserted { get; set; }
///
/// The number of documents updated when conflict is set to "replace" or "update".
///
public ulong Replaced { get; set; }
///
/// The number of documents whose fields are identical to existing documents with the same primary key when conflict is set to "replace" or "update".
///
public ulong Unchanged { get; set; }
///
/// The number of errors encountered while performing the insert.
///
public ulong Errors { get; set; }
///
/// If errors were encountered, contains the text of the first error.
///
[JsonProperty("first_error")]
public string FirstError { get; set; }
///
/// Deleted: 0 for an insert operation.
///
public ulong Deleted { get; set; }
///
/// Skipped: 0 for an insert operation.
///
public ulong Skipped { get; set; }
///
/// If the field generated_keys is truncated, you will get the warning “Too many generated keys (...), array truncated to 100000.”.
///
public string[] Warnings { get; set; }
///
/// If returnChanges is set to true, this will be an array of objects, one for each objected affected by the insert operation. Each object will have two keys: {new_val: -new value-, old_val: null}.
///
public JArray Changes { get; set; }
///
/// If the query had return_changes set, get the changes as .
///
public Change[] ChangesAs()
{
return this.Changes?.ToObject[]>(Net.Converter.Serializer);
}
///
/// The value is an integer indicating the number of tables waited for. It will always be 1 when wait is called on a table, and the total number of tables when called on a database.
///
public uint? Ready { get; set; } //probably need to move this to something like AdminResult or DdlResult
///
/// The number of databases created.
///
[JsonProperty("dbs_created")]
public uint DatabasesCreated { get; set; }
///
/// The number of databases dropped.
///
[JsonProperty("dbs_dropped")]
public uint DatabasesDropped { get; set; }
///
/// The number of tables created.
///
[JsonProperty("tables_created")]
public uint TablesCreated { get; set; }
///
/// The number of tables dropped.
///
[JsonProperty("tables_dropped")]
public uint TablesDropped { get; set; }
}
}