fix(type_mapper): handle PostgreSQL array types in tags

* Update BuildBunTag to append "array" for array types
* Add tests for handling array types in TypeMapper
* Adjust regex in SanitizeStructTagValue to preserve array suffix
This commit is contained in:
2026-05-03 16:11:01 +02:00
parent 15763f60cc
commit b8f60203cb
4 changed files with 49 additions and 3 deletions

View File

@@ -207,7 +207,8 @@ func quoteSQLLiteral(value string) string {
// - Returns a clean identifier safe for use in struct tags and field names
func SanitizeStructTagValue(value string) string {
// Remove DBML/DCTX style comments in brackets (e.g., [note: 'description'])
commentRegex := regexp.MustCompile(`\s*\[.*?\]\s*`)
// Require at least one character inside brackets to avoid stripping PostgreSQL array suffix "[]"
commentRegex := regexp.MustCompile(`\s*\[[^\]]+\]\s*`)
value = commentRegex.ReplaceAllString(value, "")
// Trim whitespace