MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / RunExecOverForward

Function RunExecOverForward

tests/utils/postgres/psql_connection.go:296–326  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

294
295// RunExecOverForward runs Exec with a given query, returning the Result of the SQL command
296func 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}

Calls 3

ForwardPSQLConnectionFunction · 0.85
ExecMethod · 0.80
CloseMethod · 0.65

Tested by 2

assertFastSwitchoverFunction · 0.74