| Total Complexity | 7 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 3 | class DynamoDBGrammar{ |
||
| 4 | protected $operators = []; |
||
| 5 | |||
| 6 | protected $params = []; |
||
| 7 | |||
| 8 | // 表达式解析 where |
||
| 9 | public function parseKeyConditionExpression(){ |
||
| 10 | $expression = []; |
||
| 11 | foreach ($this->wheres as $where) { |
||
|
|
|||
| 12 | $expression[] = "{$where['column']} {$where['operator']} {$where['value']}"; |
||
| 13 | } |
||
| 14 | |||
| 15 | return implode("and", $expression); |
||
| 16 | |||
| 17 | } |
||
| 18 | |||
| 19 | // select |
||
| 20 | public function parseProjectionExpression() |
||
| 21 | { |
||
| 22 | if( reset($this->columns) != '*' ){ |
||
| 23 | return implode(",", $this->columns); |
||
| 24 | } |
||
| 25 | return null; |
||
| 26 | } |
||
| 27 | |||
| 28 | // limit |
||
| 29 | public function parseLimit(){ |
||
| 30 | return $this->limit; |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Get the grammar specific operators. |
||
| 35 | * |
||
| 36 | * @return array |
||
| 37 | */ |
||
| 38 | public function getOperators() |
||
| 39 | { |
||
| 40 | return $this->operators; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function all() |
||
| 45 | |||
| 46 | } |
||
| 47 | } |