(u *url.URL)
| 134 | } |
| 135 | |
| 136 | func instanceFromURL(u *url.URL) (instance, db string, _ error) { |
| 137 | path := u.Host + u.Path // everything after scheme but before query or fragment |
| 138 | parts := strings.SplitN(path, "/", 4) |
| 139 | if len(parts) < 4 { |
| 140 | return "", "", fmt.Errorf("%s is not in the form project/region/instance/dbname", path) |
| 141 | } |
| 142 | if slices.Contains(parts, "") { |
| 143 | return "", "", fmt.Errorf("%s is not in the form project/region/instance/dbname", path) |
| 144 | } |
| 145 | return parts[0] + ":" + parts[1] + ":" + parts[2], parts[3], nil |
| 146 | } |
| 147 | |
| 148 | type pqDriver struct { |
| 149 | client *proxy.Client |
no outgoing calls