Skip to content

Commit 9a76d1e

Browse files
committed
Add support for ULID generation in formatAsSqlFunction and update type functions
1 parent d49f21d commit 9a76d1e

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/InsertEdit.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,13 @@ private function formatAsSqlFunction(
10681068
return $this->dbi->quoteString($uuid);
10691069
}
10701070

1071+
if ($editField->function === 'ULID') {
1072+
/* generate ULID */
1073+
$ulid = (string) Ulid::generate();
1074+
1075+
return $this->dbi->quoteString($ulid);
1076+
}
1077+
10711078
if (
10721079
in_array($editField->function, $this->getGisFromTextFunctions(), true)
10731080
|| in_array($editField->function, $this->getGisFromWKBFunctions(), true)

src/Types.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ public function getFunctionsClass(TypeClass $class): array
395395
'SOUNDEX',
396396
'SPACE',
397397
'TRIM',
398+
'ULID',
398399
'UNCOMPRESS',
399400
'UNHEX',
400401
'UPPER',

0 commit comments

Comments
 (0)