Skip to content

Commit

Permalink
feat: introduces ARRAY_CONTAINS_ANY and IN to operator enum
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and bcoe committed Oct 10, 2019
1 parent 76a879d commit 2c8869d
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 101 deletions.
22 changes: 11 additions & 11 deletions dev/protos/google/firestore/admin/v1/operation.proto
Expand Up @@ -162,17 +162,6 @@ message ExportDocumentsResponse {
string output_uri_prefix = 1;
}

// Describes the progress of the operation.
// Unit of work is generic and must be interpreted based on where [Progress][google.firestore.admin.v1.Progress]
// is used.
message Progress {
// The amount of work estimated.
int64 estimated_work = 1;

// The amount of work completed.
int64 completed_work = 2;
}

// Describes the state of the operation.
enum OperationState {
// Unspecified.
Expand Down Expand Up @@ -201,3 +190,14 @@ enum OperationState {
// google.longrunning.Operations.CancelOperation.
CANCELLED = 7;
}

// Describes the progress of the operation.
// Unit of work is generic and must be interpreted based on where [Progress][google.firestore.admin.v1.Progress]
// is used.
message Progress {
// The amount of work estimated.
int64 estimated_work = 1;

// The amount of work completed.
int64 completed_work = 2;
}
46 changes: 27 additions & 19 deletions dev/protos/google/firestore/v1/query.proto
Expand Up @@ -102,6 +102,14 @@ message StructuredQuery {

// Contains. Requires that the field is an array.
ARRAY_CONTAINS = 7;

// In. Requires that `value` is a non-empty ArrayValue with at most 10
// values.
IN = 8;

// Contains any. Requires that the field is an array and
// `value` is a non-empty ArrayValue with at most 10 values.
ARRAY_CONTAINS_ANY = 9;
}

// The field to filter by.
Expand All @@ -114,18 +122,6 @@ message StructuredQuery {
Value value = 3;
}

// A sort direction.
enum Direction {
// Unspecified.
DIRECTION_UNSPECIFIED = 0;

// Ascending.
ASCENDING = 1;

// Descending.
DESCENDING = 2;
}

// A filter with a single operand.
message UnaryFilter {
// A unary operator.
Expand All @@ -150,6 +146,15 @@ message StructuredQuery {
}
}

// The projection of document's fields to return.
message Projection {
// The fields to return.
//
// If empty, all fields are returned. To only return the name
// of the document, use `['__name__']`.
repeated FieldReference fields = 2;
}

// An order on a field.
message Order {
// The field to order by.
Expand All @@ -164,13 +169,16 @@ message StructuredQuery {
string field_path = 2;
}

// The projection of document's fields to return.
message Projection {
// The fields to return.
//
// If empty, all fields are returned. To only return the name
// of the document, use `['__name__']`.
repeated FieldReference fields = 2;
// A sort direction.
enum Direction {
// Unspecified.
DIRECTION_UNSPECIFIED = 0;

// Ascending.
ASCENDING = 1;

// Descending.
DESCENDING = 2;
}

// The projection to return.
Expand Down
26 changes: 17 additions & 9 deletions dev/protos/google/firestore/v1beta1/query.proto
Expand Up @@ -102,6 +102,14 @@ message StructuredQuery {

// Contains. Requires that the field is an array.
ARRAY_CONTAINS = 7;

// In. Requires that `value` is a non-empty ArrayValue with at most 10
// values.
IN = 8;

// Contains any. Requires that the field is an array and
// `value` is a non-empty ArrayValue with at most 10 values.
ARRAY_CONTAINS_ANY = 9;
}

// The field to filter by.
Expand Down Expand Up @@ -147,6 +155,15 @@ message StructuredQuery {
Direction direction = 2;
}

// The projection of document's fields to return.
message Projection {
// The fields to return.
//
// If empty, all fields are returned. To only return the name
// of the document, use `['__name__']`.
repeated FieldReference fields = 2;
}

// A reference to a field, such as `max(messages.time) as max_time`.
message FieldReference {
string field_path = 2;
Expand All @@ -164,15 +181,6 @@ message StructuredQuery {
DESCENDING = 2;
}

// The projection of document's fields to return.
message Projection {
// The fields to return.
//
// If empty, all fields are returned. To only return the name
// of the document, use `['__name__']`.
repeated FieldReference fields = 2;
}

// The projection to return.
Projection select = 1;

Expand Down
54 changes: 29 additions & 25 deletions dev/protos/protos.json
Expand Up @@ -1363,18 +1363,13 @@
"GREATER_THAN": 3,
"GREATER_THAN_OR_EQUAL": 4,
"EQUAL": 5,
"ARRAY_CONTAINS": 7
"ARRAY_CONTAINS": 7,
"IN": 8,
"ARRAY_CONTAINS_ANY": 9
}
}
}
},
"Direction": {
"values": {
"DIRECTION_UNSPECIFIED": 0,
"ASCENDING": 1,
"DESCENDING": 2
}
},
"UnaryFilter": {
"oneofs": {
"operandType": {
Expand Down Expand Up @@ -1403,6 +1398,15 @@
}
}
},
"Projection": {
"fields": {
"fields": {
"rule": "repeated",
"type": "FieldReference",
"id": 2
}
}
},
"Order": {
"fields": {
"field": {
Expand All @@ -1423,13 +1427,11 @@
}
}
},
"Projection": {
"fields": {
"fields": {
"rule": "repeated",
"type": "FieldReference",
"id": 2
}
"Direction": {
"values": {
"DIRECTION_UNSPECIFIED": 0,
"ASCENDING": 1,
"DESCENDING": 2
}
}
}
Expand Down Expand Up @@ -2633,7 +2635,9 @@
"GREATER_THAN": 3,
"GREATER_THAN_OR_EQUAL": 4,
"EQUAL": 5,
"ARRAY_CONTAINS": 7
"ARRAY_CONTAINS": 7,
"IN": 8,
"ARRAY_CONTAINS_ANY": 9
}
}
}
Expand Down Expand Up @@ -2678,6 +2682,15 @@
}
}
},
"Projection": {
"fields": {
"fields": {
"rule": "repeated",
"type": "FieldReference",
"id": 2
}
}
},
"FieldReference": {
"fields": {
"fieldPath": {
Expand All @@ -2692,15 +2705,6 @@
"ASCENDING": 1,
"DESCENDING": 2
}
},
"Projection": {
"fields": {
"fields": {
"rule": "repeated",
"type": "FieldReference",
"id": 2
}
}
}
}
},
Expand Down
50 changes: 31 additions & 19 deletions dev/src/v1/doc/google/firestore/v1/doc_query.js
Expand Up @@ -239,6 +239,18 @@ const StructuredQuery = {
* Contains. Requires that the field is an array.
*/
ARRAY_CONTAINS: 7,

/**
* In. Requires that `value` is a non-empty ArrayValue with at most 10
* values.
*/
IN: 8,

/**
* Contains any. Requires that the field is an array and
* `value` is a non-empty ArrayValue with at most 10 values.
*/
ARRAY_CONTAINS_ANY: 9,
},
},

Expand Down Expand Up @@ -286,6 +298,25 @@ const StructuredQuery = {
},
},

/**
* The projection of document's fields to return.
*
* @property {Object[]} fields
* The fields to return.
*
* If empty, all fields are returned. To only return the name
* of the document, use `['__name__']`.
*
* This object should have the same structure as [FieldReference]{@link google.firestore.v1.FieldReference}
*
* @typedef Projection
* @memberof google.firestore.v1
* @see [google.firestore.v1.StructuredQuery.Projection definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/firestore/v1/query.proto}
*/
Projection: {
// This is for documentation. Actual contents will be loaded by gRPC.
},

/**
* An order on a field.
*
Expand Down Expand Up @@ -320,25 +351,6 @@ const StructuredQuery = {
// This is for documentation. Actual contents will be loaded by gRPC.
},

/**
* The projection of document's fields to return.
*
* @property {Object[]} fields
* The fields to return.
*
* If empty, all fields are returned. To only return the name
* of the document, use `['__name__']`.
*
* This object should have the same structure as [FieldReference]{@link google.firestore.v1.FieldReference}
*
* @typedef Projection
* @memberof google.firestore.v1
* @see [google.firestore.v1.StructuredQuery.Projection definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/firestore/v1/query.proto}
*/
Projection: {
// This is for documentation. Actual contents will be loaded by gRPC.
},

/**
* A sort direction.
*
Expand Down
38 changes: 25 additions & 13 deletions dev/src/v1beta1/doc/google/firestore/v1beta1/doc_query.js
Expand Up @@ -239,6 +239,18 @@ const StructuredQuery = {
* Contains. Requires that the field is an array.
*/
ARRAY_CONTAINS: 7,

/**
* In. Requires that `value` is a non-empty ArrayValue with at most 10
* values.
*/
IN: 8,

/**
* Contains any. Requires that the field is an array and
* `value` is a non-empty ArrayValue with at most 10 values.
*/
ARRAY_CONTAINS_ANY: 9,
},
},

Expand Down Expand Up @@ -307,19 +319,6 @@ const StructuredQuery = {
// This is for documentation. Actual contents will be loaded by gRPC.
},

/**
* A reference to a field, such as `max(messages.time) as max_time`.
*
* @property {string} fieldPath
*
* @typedef FieldReference
* @memberof google.firestore.v1beta1
* @see [google.firestore.v1beta1.StructuredQuery.FieldReference definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/firestore/v1beta1/query.proto}
*/
FieldReference: {
// This is for documentation. Actual contents will be loaded by gRPC.
},

/**
* The projection of document's fields to return.
*
Expand All @@ -339,6 +338,19 @@ const StructuredQuery = {
// This is for documentation. Actual contents will be loaded by gRPC.
},

/**
* A reference to a field, such as `max(messages.time) as max_time`.
*
* @property {string} fieldPath
*
* @typedef FieldReference
* @memberof google.firestore.v1beta1
* @see [google.firestore.v1beta1.StructuredQuery.FieldReference definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/firestore/v1beta1/query.proto}
*/
FieldReference: {
// This is for documentation. Actual contents will be loaded by gRPC.
},

/**
* A sort direction.
*
Expand Down

0 comments on commit 2c8869d

Please sign in to comment.