-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc961c2
commit 903d50f
Showing
7 changed files
with
58 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package workspace | ||
|
||
import "github.com/turbot/steampipe/steampipeconfig/modconfig" | ||
|
||
type SessionDataSource struct { | ||
preparedStatementSource, introspectionTableSource *modconfig.WorkspaceResourceMaps | ||
} | ||
|
||
// NewSessionDataSource creates a new SessionDataSource object | ||
// if a single parameter is poassed, this map is used for both prepared statements and introspection tables | ||
// if a second parameter is passed, it will be a minimal set of resources for which we need to create prepared statements | ||
// this will be populated for batch mode querying | ||
func NewSessionDataSource(items ...*modconfig.WorkspaceResourceMaps) *SessionDataSource { | ||
if len(items) == 0 { | ||
panic("NewSessionStateSource called with no parameters") | ||
} | ||
if len(items) > 2 { | ||
panic("NewSessionStateSource called with more than 2 parameters") | ||
} | ||
// default to initialising introspectionTableSource AND preparedStatementSource from the first param, | ||
// which is expected to be the full map of workspace resources | ||
res := &SessionDataSource{ | ||
introspectionTableSource: items[0], | ||
preparedStatementSource: items[0], | ||
} | ||
// is the preparedStatementSource explicitly provided? | ||
if len(items) == 2 { | ||
res.preparedStatementSource = items[1] | ||
} | ||
return res | ||
|
||
} |