mirror of
https://codeberg.org/vlw/scaffold.git
synced 2025-11-05 06:02:42 +01:00
Compare commits
No commits in common. "master" and "1.3.2" have entirely different histories.
2 changed files with 34 additions and 38 deletions
|
|
@ -72,8 +72,9 @@
|
||||||
*
|
*
|
||||||
* @return bool Entity exists
|
* @return bool Entity exists
|
||||||
*/
|
*/
|
||||||
public function isset(): bool {
|
public bool $isset {
|
||||||
return $this->_isset ??= new Database()
|
// Returns bool if row is set or attempts to resolve and set if null
|
||||||
|
get => $this->_isset ??= new Database()
|
||||||
->from($this->table)
|
->from($this->table)
|
||||||
->where($this->where)
|
->where($this->where)
|
||||||
->limit(1)
|
->limit(1)
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,14 @@
|
||||||
|
|
||||||
namespace vlw\Scaffold\Helpers;
|
namespace vlw\Scaffold\Helpers;
|
||||||
|
|
||||||
/**
|
const UUID_LENGTH = 36;
|
||||||
* Generate Universally unique identifiers
|
|
||||||
*/
|
|
||||||
class UUID {
|
|
||||||
public const LENGTH = 36;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate an all binary 0:s UUID
|
* Generate an all binary 0:s UUID
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function nil(): string {
|
function uuid_nil(): string {
|
||||||
return "00000000-0000-0000-0000-000000000000";
|
return "00000000-0000-0000-0000-000000000000";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -22,7 +18,7 @@
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function max(): string {
|
function uuid_max(): string {
|
||||||
return "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF";
|
return "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -31,7 +27,7 @@
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function v4(): string {
|
function uuid_v4(): string {
|
||||||
return sprintf("%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
|
return sprintf("%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
|
||||||
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
|
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
|
||||||
mt_rand(0, 0xffff),
|
mt_rand(0, 0xffff),
|
||||||
|
|
@ -40,4 +36,3 @@
|
||||||
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
|
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue