mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2025-11-13 18:03:53 +00:00
17 lines
431 B
Go
17 lines
431 B
Go
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
|
|
}
|