RunExecOverForward runs Exec with a given query, returning the Result of the SQL command
( ctx context.Context, crudClient client.Client, kubeInterface kubernetes.Interface, restConfig *rest.Config, namespace, clusterName, dbname, secretSuffix, query string, )
| 294 | |
| 295 | // RunExecOverForward runs Exec with a given query, returning the Result of the SQL command |
| 296 | func RunExecOverForward( |
| 297 | ctx context.Context, |
| 298 | crudClient client.Client, |
| 299 | kubeInterface kubernetes.Interface, |
| 300 | restConfig *rest.Config, |
| 301 | namespace, |
| 302 | clusterName, |
| 303 | dbname, |
| 304 | secretSuffix, |
| 305 | query string, |
| 306 | ) (sql.Result, error) { |
| 307 | forward, conn, err := ForwardPSQLConnection( |
| 308 | ctx, |
| 309 | crudClient, |
| 310 | kubeInterface, |
| 311 | restConfig, |
| 312 | namespace, |
| 313 | clusterName, |
| 314 | dbname, |
| 315 | secretSuffix, |
| 316 | ) |
| 317 | if err != nil { |
| 318 | return nil, err |
| 319 | } |
| 320 | defer func() { |
| 321 | _ = conn.Close() |
| 322 | forward.Close() |
| 323 | }() |
| 324 | |
| 325 | return conn.Exec(query) |
| 326 | } |