Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit 63dd036

Browse files
authored
PHPLIB-1381 PHPLIB-1269 Add enum for Sort and TimeUnit (#63)
1 parent ceac70d commit 63dd036

File tree

84 files changed

+400
-238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+400
-238
lines changed

generator/config/accumulator/derivative.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ arguments:
1616
-
1717
name: unit
1818
type:
19-
- string
19+
- timeUnit
2020
optional: true
2121
description: |
2222
A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond".

generator/config/accumulator/integral.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ arguments:
1616
-
1717
name: unit
1818
type:
19-
- resolvesToString
19+
- timeUnit
2020
optional: true
2121
description: |
2222
A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond".

generator/config/expression/dateAdd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ arguments:
1818
-
1919
name: unit
2020
type:
21-
- resolvesToString
21+
- timeUnit
2222
description: |
2323
The unit used to measure the amount of time added to the startDate.
2424
-

generator/config/expression/dateDiff.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ arguments:
2626
-
2727
name: unit
2828
type:
29-
- resolvesToString
29+
- timeUnit
3030
description: |
3131
The time measurement unit between the startDate and endDate
3232
-

generator/config/expression/dateSubtract.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ arguments:
1818
-
1919
name: unit
2020
type:
21-
- resolvesToString
21+
- timeUnit
2222
description: |
2323
The unit used to measure the amount of time added to the startDate.
2424
-

generator/config/expression/dateTrunc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ arguments:
1818
-
1919
name: unit
2020
type:
21-
- resolvesToString
21+
- timeUnit
2222
description: |
2323
The unit of time, specified as an expression that must resolve to one of these strings: year, quarter, week, month, day, hour, minute, second.
2424
Together, binSize and unit specify the time period used in the $dateTrunc calculation.

generator/config/expression/sortArray.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ arguments:
2020
type:
2121
- object # SortSpec
2222
- int
23+
- sortSpec
2324
description: |
2425
The document specifies a sort ordering.
2526
tests:

generator/config/expressions.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@
117117
'returnType' => Type\SwitchBranchInterface::class,
118118
'acceptedTypes' => [Type\SwitchBranchInterface::class, ...$bsonTypes['object']],
119119
],
120+
'timeUnit' => [
121+
'returnType' => Type\TimeUnit::class,
122+
'acceptedTypes' => [Type\TimeUnit::class, ResolvesToString::class, ...$bsonTypes['string']],
123+
],
124+
'sortSpec' => [
125+
'returnType' => Type\Sort::class,
126+
'acceptedTypes' => [Type\Sort::class],
127+
],
120128

121129
// @todo add enum values
122130
'Granularity' => [

generator/config/query/text.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ tests:
102102
$text:
103103
$search: 'CAFÉ'
104104
$diacriticSensitive: true
105+
-
106+
$project:
105107
score:
106108
$meta: 'textScore'
107109
-

generator/config/schema.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@
115115
"expression",
116116
"geometry",
117117
"fieldPath",
118+
"timeUnit",
119+
"sortSpec",
118120
"any",
119121
"resolvesToNumber", "numberFieldPath", "number",
120122
"resolvesToDouble", "doubleFieldPath", "double",

0 commit comments

Comments
 (0)