sqlite-requests 0.0.2

Represent SQLite queries and executes as request objects
syntax = "proto3";

package sqlite_commands;

// TODO: Rename Result -> Response

message ProtoQueryRequest {
  string sql = 1;
  ProtoQueuedParameters queued_parameters = 2;
}

message ProtoQueuedParameters {
  oneof queued_parameters {
    ProtoQueuedIndexedParameters queued_indexed_parameters = 1;
    ProtoQueuedNamedParameters queued_named_parameters = 2;
  }
}

message ProtoQueuedIndexedParameters {
  repeated ProtoIndexedParameters queued_indexed_parameters = 1;
}

message ProtoQueuedNamedParameters {
  repeated ProtoNamedParameters queued_named_parameters = 1;
}

message ProtoIndexedParameters {
  repeated ProtoValue parameters = 1;
}

message ProtoNamedParameters {
  repeated ProtoNamedParameter parameters = 1;
}

message ProtoNamedParameter {
  string name = 1;
  ProtoValue value = 2;
}

message ProtoValue {
  oneof value {
    /// The value is a `NULL` value.
    ProtoNull null = 1;
    /// The value is a signed integer.
    int64 integer = 2;
    /// The value is a floating point number.
    double real = 3;
    /// The value is a text string.
    string text = 4;
    /// The value is a blob of data
    bytes blob = 5;
  }
}

message ProtoNull {
}

message ProtoQueryResponse {
  repeated ProtoQueryResultSet query_result_sets = 1;
}

message ProtoQueryResultSet {
  repeated ProtoQueryResultRow rows = 1;
}

message ProtoQueryResultRow {
  repeated ProtoValue row = 1;
}

message ProtoExecuteRequest {
  string sql = 1;
  ProtoQueuedParameters queued_parameters = 2;
}

message ProtoExecuteResponse {
  repeated ProtoExecuteResult execute_results = 1;
}

message ProtoExecuteResult {
  uint64 changes = 1;
}

message ProtoBulkQueryRequest {
  repeated ProtoQueryRequest queries = 1;
}

message ProtoBulkQueryResponse {
  repeated ProtoQueryResponse query_responses = 1;
}

message ProtoBulkExecuteRequest {
  repeated ProtoExecuteRequest executes = 1;
}

message ProtoBulkExecuteResponse {
  repeated ProtoExecuteResponse execute_responses = 1;
}

message ProtoSqliteRequest {
  oneof request {
    ProtoSqliteQuery query = 1;
    ProtoSqliteExecute execute = 2;
  }
}

message ProtoSqliteResponse {
  oneof response {
    ProtoSqliteQueryResponse query = 1;
    ProtoSqliteExecuteResponse execute = 2;
  }
}

message ProtoSqliteQuery {
  oneof query {
    ProtoQueryRequest single = 1;
    ProtoBulkQueryRequest bulk = 2;
  }
}

message ProtoSqliteQueryResponse {
  oneof response {
    ProtoQueryResponse single = 1;
    ProtoBulkQueryResponse bulk = 2;
  }
}

message ProtoSqliteExecute {
  oneof execute {
    ProtoExecuteRequest single = 1;
    ProtoBulkExecuteRequest bulk = 2;
  }
}

message ProtoSqliteExecuteResponse {
  oneof response {
    ProtoExecuteResponse single = 1;
    ProtoBulkExecuteResponse bulk = 2;
  }
}