-
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.
Added created to db tables, new edge/data syntax, others (#8)
* Added created to db tables, new edge/data syntax, others * [CodeFactor] Apply fixes * Added unit test, updated some examples of new edge syntax
- Loading branch information
1 parent
f02f9ef
commit 4ef2c08
Showing
20 changed files
with
194 additions
and
33 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
trait GPDataTypeCreator { | ||
|
||
public static function array($name, ...$args) { | ||
return new GPDataType($name, GPDataType::GP_ARRAY, ...$args); | ||
} | ||
|
||
public static function string($name, ...$args) { | ||
return new GPDataType($name, GPDataType::GP_STRING, ...$args); | ||
} | ||
|
||
public static function bool($name, ...$args) { | ||
return new GPDataType($name, GPDataType::GP_BOOL, ...$args); | ||
} | ||
|
||
public static function int($name, ...$args) { | ||
return new GPDataType($name, GPDataType::GP_INT, ...$args); | ||
} | ||
|
||
public static function float($name, ...$args) { | ||
return new GPDataType($name, GPDataType::GP_FLOAT, ...$args); | ||
} | ||
|
||
public static function number($name, ...$args) { | ||
return new GPDataType($name, GPDataType::GP_NUMBER, ...$args); | ||
} | ||
|
||
public static function any($name, ...$args) { | ||
return new GPDataType($name, GPDataType::GP_ANY, ...$args); | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
trait GPNodeEdgeCreator { | ||
|
||
public static function edge(string $name = null) { | ||
return new GPEdgeType(get_called_class(), $name ?: STR::pluralize(get_called_class())); | ||
} | ||
|
||
public static function singleEdge(string $single_name = null, string $plural_name = null) { | ||
$defaulted_single_name = $single_name ?: get_called_class(); | ||
$defaulted_plural_name = $plural_name ?: STR::pluralize($defaulted_single_name); | ||
return (new GPEdgeType(get_called_class(), $defaulted_plural_name)) | ||
->setSingleNodeName($defaulted_single_name); | ||
} | ||
} |
Oops, something went wrong.