mirror of
https://github.com/turbot/steampipe.git
synced 2026-04-11 07:00:06 -04:00
31 lines
606 B
Go
31 lines
606 B
Go
package modconfig
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// ResolvedQuery contains the execute SQL, raw SQL and args string used to execute a query
|
|
type ResolvedQuery struct {
|
|
ExecuteSQL string
|
|
RawSQL string
|
|
Args []any
|
|
}
|
|
|
|
|
|
// QueryArgs converts the ResolvedQuery into QueryArgs
|
|
func (r ResolvedQuery) QueryArgs() *QueryArgs {
|
|
res := NewQueryArgs()
|
|
|
|
res.ArgList = make([]*string, len(r.Args))
|
|
|
|
for i, a := range r.Args {
|
|
// TACTICAL convert to JSON representation
|
|
jsonBytes, err := json.Marshal(a)
|
|
argStr := string(jsonBytes)
|
|
if err != nil {
|
|
res.ArgList[i] = &argStr
|
|
}
|
|
}
|
|
return res
|
|
}
|