mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 11:15:12 +00:00
67 lines
1.3 KiB
Protocol Buffer
67 lines
1.3 KiB
Protocol Buffer
syntax = "proto3";
|
|
import "google/protobuf/struct.proto";
|
|
|
|
package db;
|
|
|
|
option go_package = "./proto;db";
|
|
|
|
service Db {
|
|
rpc Create(CreateRequest) returns (CreateResponse) {}
|
|
rpc Read(ReadRequest) returns (ReadResponse) {}
|
|
rpc Update(UpdateRequest) returns (UpdateResponse) {}
|
|
rpc Delete(DeleteRequest) returns (DeleteResponse) {}
|
|
}
|
|
|
|
|
|
message ReadRequest {
|
|
string table = 1;
|
|
// eg. 'age >= 18', 'age >= 18 and verified == true'
|
|
// comparison operators: '==', '!=', '<', '>', '<=', '>='
|
|
// logical operator: 'and'
|
|
string query = 2;
|
|
int32 offset = 3;
|
|
int32 limit = 4;
|
|
// field name to order by
|
|
string orderBy = 5;
|
|
// 'asc' (default), 'desc'
|
|
string order = 6;
|
|
}
|
|
|
|
message ReadResponse {
|
|
// JSON encoded records
|
|
repeated google.protobuf.Struct records = 1;
|
|
}
|
|
|
|
message CreateRequest {
|
|
string table = 1;
|
|
// JSON encoded record or records (can be array or object)
|
|
google.protobuf.Struct record = 2;
|
|
}
|
|
|
|
message CreateResponse {
|
|
// The id of the record
|
|
string id = 1;
|
|
}
|
|
|
|
message UpdateRequest {
|
|
string table = 1;
|
|
// query filter if applying to multiple records
|
|
string query = 2;
|
|
// record, JSON object
|
|
google.protobuf.Struct record = 3;
|
|
}
|
|
|
|
message UpdateResponse {
|
|
|
|
}
|
|
|
|
message DeleteRequest {
|
|
string table = 1;
|
|
// id or ids, eg. 'user-1', or comma separated ids 'user-1,user-2'
|
|
string id = 2;
|
|
}
|
|
|
|
message DeleteResponse {
|
|
|
|
}
|