/
githubmirror
/
pocketbase
Обзор
Документация
Войти
/
githubmirror
/
pocketbase
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tools/dbutils/select.go
18 строк
537 B
Gani Georgiev
fixed typo and updated changelog
13 янв 2026, 23:23
13 янв 2026, 23:23
2af60a8
Код
Авторство
О чём код?
package dbutils import "regexp" // Regexp for columns and tables (the same as the one in dbx). var selectRegex = regexp.MustCompile(`(?i:\s+as\s+|\s+)([\w\-_\.]+)$`) // AliasOrIdentifier returns the alias from a column or table identifier. // Returns the identifier unmodified if no alias was found. func AliasOrIdentifier(columnOrTableIdentifier string) string { matches := selectRegex.FindStringSubmatch(columnOrTableIdentifier) if len(matches) > 0 && matches[1] != "" { return matches[1] } return columnOrTableIdentifier }