extractShortName extracts the last segment from a resource name like "instances/prod-pg" or "projects/hr-system".
(resourceName string)
| 300 | |
| 301 | // extractShortName extracts the last segment from a resource name like "instances/prod-pg" or "projects/hr-system". |
| 302 | func extractShortName(resourceName string) string { |
| 303 | parts := strings.Split(resourceName, "/") |
| 304 | if len(parts) >= 2 { |
| 305 | return parts[len(parts)-1] |
| 306 | } |
| 307 | return resourceName |
| 308 | } |
| 309 | |
| 310 | // selectDataSource picks READ_ONLY if available, otherwise ADMIN. |
| 311 | func selectDataSource(dataSources []dataSource) string { |
no outgoing calls
no test coverage detected