-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from howyi/add-partition
Add partition
- Loading branch information
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Conv\Structure; | ||
|
||
class PartitionPartStructure | ||
{ | ||
private $name; | ||
private $operator; | ||
private $value; | ||
private $engine; | ||
|
||
/** | ||
* @param string $name | ||
* @param string $operator | ||
* @param string $value | ||
* @param string $engine | ||
*/ | ||
public function __construct( | ||
string $name, | ||
string $operator, | ||
string $value, | ||
string $engine | ||
) { | ||
$this->name = $name; | ||
$this->operator = $operator; | ||
$this->value = $value; | ||
$this->engine = $engine; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getQuery(): string | ||
{ | ||
return sprintf( | ||
'PARTITION %s VALUES %s (%s) ENGINE = %s', | ||
$this->name, | ||
$this->operator, | ||
$this->value, | ||
$this->engine | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Conv\Structure; | ||
|
||
class PartitionStructure | ||
{ | ||
private $expression; | ||
private $type; | ||
private $nameOrder; | ||
private $parts; | ||
|
||
/** | ||
* @param string $expression | ||
* @param string $type | ||
* @param string[] $nameOrder | ||
* @param PartitionPartStructure[] $parts | ||
*/ | ||
public function __construct( | ||
string $expression, | ||
string $type, | ||
array $nameOrder, | ||
array $parts | ||
) { | ||
$this->expression = $expression; | ||
$this->type = $type; | ||
$this->nameOrder = $nameOrder; | ||
$this->parts = $parts; | ||
} | ||
} |