pg support: group_concat

This commit is contained in:
xiaomlove
2026-04-25 13:44:23 +07:00
parent 7d18a7f76a
commit 1372776ba1
3 changed files with 17 additions and 4 deletions
+12 -1
View File
@@ -533,7 +533,7 @@ class NexusDB
}
}
public static function upsertField(array $uniqueFields, array $updateFields): string
public static function upsertField(array $uniqueFields, array $updateFields = []): string
{
if (self::isMysql()) {
$updates = [];
@@ -557,4 +557,15 @@ class NexusDB
}
}
public static function groupConcatField(string $field): string
{
if (self::isMysql()) {
return sprintf("group_concat(%s)", $field);
} elseif (self::isPgsql()) {
return sprintf("string_agg(%s::text, ',')", $field);
} else {
throw new \RuntimeException('Not supported database.');
}
}
}