MCPcopy
hub / github.com/turbot/steampipe / executeMetaquery

Method executeMetaquery

pkg/interactive/interactive_client.go:515–543  ·  view source on GitHub ↗
(ctx context.Context, query string)

Source from the content-addressed store, hash-verified

513}
514
515func (c *InteractiveClient) executeMetaquery(ctx context.Context, query string) error {
516 // the client must be initialised to get here
517 if !c.isInitialised() {
518 return fmt.Errorf("client is not initialised")
519 }
520 // validate the metaquery arguments
521 validateResult := metaquery.Validate(query)
522 if validateResult.Message != "" {
523 fmt.Println(validateResult.Message)
524 }
525 if err := validateResult.Err; err != nil {
526 return err
527 }
528 if !validateResult.ShouldRun {
529 return nil
530 }
531 client := c.client()
532
533 // validation passed, now we will run
534 return metaquery.Handle(ctx, &metaquery.HandlerInput{
535 Query: query,
536 Client: client,
537 Schema: c.schemaMetadata,
538 SearchPath: client.GetRequiredSessionSearchPath(),
539 Prompt: c.interactivePrompt,
540 ClosePrompt: func() { c.afterClose = AfterPromptCloseExit },
541 GetConnectionStateMap: c.getConnectionState,
542 })
543}
544
545// helper function to acquire db connection and retrieve connection state
546func (c *InteractiveClient) getConnectionState(ctx context.Context) (steampipeconfig.ConnectionStateMap, error) {

Callers 2

executorMethod · 0.95

Calls 5

isInitialisedMethod · 0.95
clientMethod · 0.95
ValidateFunction · 0.92
HandleFunction · 0.92

Tested by 1