Files
steampipe/pkg/interactive/metaquery/handler_search_path.go
kaidaguerre 40804a3201 Execute RefreshConnections asyncronously and optimise for high connection count. Add connection_state table.
- Execute RefreshConnections asyncronously
- Add connection_state table to indicate the loading state of connections
- Optimise RefreshConnections by cloning connection schemas
- Add locking to ensure only a single instance of RefreshConnections runs
- Start executing queries without waiting for connections to load, add smart error handling to wait for required connection
- Optimise autocomplete for high connection count
- Autocomplete and inspect data available before all conections are refreshed
- Update file watcher to respond to CHMOD, so thaat it pickes up deletion of file contents

 Closes #3394
 Closes #3267
2023-05-10 09:05:08 +01:00

58 lines
1.6 KiB
Go

package metaquery
import (
"context"
"strings"
"github.com/spf13/viper"
"github.com/turbot/go-kit/helpers"
"github.com/turbot/steampipe/pkg/constants"
"github.com/turbot/steampipe/pkg/display"
)
func setOrGetSearchPath(ctx context.Context, input *HandlerInput) error {
if len(input.args()) == 0 {
sessionSearchPath := input.Client.GetRequiredSessionSearchPath()
sessionSearchPath = helpers.RemoveFromStringSlice(sessionSearchPath, constants.InternalSchema)
display.ShowWrappedTable(
[]string{"search_path"},
[][]string{
{strings.Join(sessionSearchPath, ",")},
},
&display.ShowWrappedTableOptions{AutoMerge: false},
)
} else {
arg := input.args()[0]
var paths []string
split := strings.Split(arg, ",")
for _, s := range split {
s = strings.TrimSpace(s)
paths = append(paths, s)
}
viper.Set(constants.ArgSearchPath, paths)
// now that the viper is set, call back into the client (exposed via QueryExecutor) which
// already knows how to setup the search_paths with the viper values
input.Client.SetRequiredSessionSearchPath(ctx)
}
return nil
}
func setSearchPathPrefix(ctx context.Context, input *HandlerInput) error {
arg := input.args()[0]
paths := []string{}
split := strings.Split(arg, ",")
for _, s := range split {
s = strings.TrimSpace(s)
paths = append(paths, s)
}
viper.Set(constants.ArgSearchPathPrefix, paths)
// now that the viper is set, call back into the client (exposed via QueryExecutor) which
// already knows how to setup the search_paths with the viper values
input.Client.SetRequiredSessionSearchPath(ctx)
return nil
}