Fixed tablename and schema lookups

This commit is contained in:
Hein
2025-11-07 10:28:14 +02:00
parent e88018543e
commit 3b2d05465e
6 changed files with 282 additions and 38 deletions

View File

@@ -0,0 +1,13 @@
package database
import "strings"
// parseTableName splits a table name that may contain schema into separate schema and table
// For example: "public.users" -> ("public", "users")
// "users" -> ("", "users")
func parseTableName(fullTableName string) (schema, table string) {
if idx := strings.LastIndex(fullTableName, "."); idx != -1 {
return fullTableName[:idx], fullTableName[idx+1:]
}
return "", fullTableName
}