-
Notifications
You must be signed in to change notification settings - Fork 1
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 #16 from vossik/sql_generators
sql generator command
- Loading branch information
Showing
54 changed files
with
795 additions
and
271 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
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,13 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace CoolBeans\Attribute; | ||
|
||
#[\Attribute(\Attribute::TARGET_PROPERTY)] | ||
final class DefaultValue | ||
{ | ||
public function __construct( | ||
public string $defaultValue | ||
) {} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace CoolBeans\Attribute\Defaults; | ||
|
||
final class MysqlDefaults | ||
{ | ||
use \Nette\StaticClass; | ||
|
||
public const CURRENT_TIMESTAMP = 'CURRENT_TIMETAMP()'; | ||
public const NOW = 'NOW()'; | ||
} |
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,28 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace CoolBeans\Attribute; | ||
|
||
#[\Attribute(\Attribute::TARGET_PROPERTY)] | ||
final class TypeOverride | ||
{ | ||
public array $lengthArgs; | ||
|
||
public function __construct( | ||
public string $type, | ||
int ...$lengthArgs | ||
) | ||
{ | ||
$this->lengthArgs = $lengthArgs; | ||
} | ||
|
||
public function getType() : string | ||
{ | ||
if (\count($this->lengthArgs) === 0) { | ||
return $this->type; | ||
} | ||
|
||
return $this->type . '(' . \implode(',', $this->lengthArgs) . ')'; | ||
} | ||
} |
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,39 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace CoolBeans\Attribute\Types; | ||
|
||
final class MysqlTypes | ||
{ | ||
use \Nette\StaticClass; | ||
|
||
public const TIMESTAMP = 'TIMESTAMP'; | ||
public const DATETIME = 'DATETIME'; | ||
public const DATE = 'DATE'; | ||
public const TIME = 'TIME'; | ||
public const YEAR = 'YEAR'; | ||
public const BIT = 'BIT'; | ||
public const INT = 'INT'; | ||
public const TINYINT = 'TINYINT'; | ||
public const SMALLINT = 'SMALLINT'; | ||
public const MEDIUMINT = 'MEDIUMINT'; | ||
public const BIGINT = 'BIGINT'; | ||
public const FLOAT = 'FLOAT'; | ||
public const DOUBLE = 'DOUBLE'; | ||
public const DECIMAL = 'DECIMAL'; | ||
public const CHAR = 'CHAR'; | ||
public const VARCHAR = 'VARCHAR'; | ||
public const BINARY = 'BINARY'; | ||
public const VARBINARY = 'VARBINARY'; | ||
public const TINYBLOB = 'TINYBLOB'; | ||
public const TINYTEXT = 'TINYTEXT'; | ||
public const TEXT = 'TEXT'; | ||
public const BLOB = 'BLOB'; | ||
public const MEDIUMTEXT = 'MEDIUMTEXT'; | ||
public const MEDIUMBLOB = 'MEDIUMBLOB'; | ||
public const LONGTEXT = 'LONGTEXT'; | ||
public const LONGBLOB = 'LONGBLOB'; | ||
public const BOOL = 'BOOL'; | ||
public const JSON = 'JSON'; | ||
} |
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
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
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
Oops, something went wrong.