Files
steampipe/pkg/steampipeconfig/postgres_notification.go
kaidaguerre 235cbc2037 Connection watching fixes.
Fix ConnectionConfigMap.Diff  inconsistent usage of Plugin and PluginInstance. Closes #3895
Fix GetConnectionStateErrorSql returning invalid query with additional parameter. Closes #3896
Update FDW to v1.8.0-rc.11 - fix failure to load connection config when importing schema
2023-09-25 12:35:00 +01:00

48 lines
1.1 KiB
Go

package steampipeconfig
import (
"github.com/turbot/steampipe/pkg/error_helpers"
)
const PostgresNotificationStructVersion = 20230306
type PostgresNotificationType int
const (
PgNotificationSchemaUpdate PostgresNotificationType = iota + 1
PgNotificationConnectionError
)
type PostgresNotification struct {
StructVersion int
Type PostgresNotificationType
}
type ErrorsAndWarningsNotification struct {
PostgresNotification
Errors []string
Warnings []string
}
func NewSchemaUpdateNotification() *PostgresNotification {
return &PostgresNotification{
StructVersion: PostgresNotificationStructVersion,
Type: PgNotificationSchemaUpdate,
}
}
func NewErrorsAndWarningsNotification(errorAndWarnings *error_helpers.ErrorAndWarnings) *ErrorsAndWarningsNotification {
res := &ErrorsAndWarningsNotification{
PostgresNotification: PostgresNotification{
StructVersion: PostgresNotificationStructVersion,
Type: PgNotificationConnectionError,
},
}
if errorAndWarnings.Error != nil {
res.Errors = []string{errorAndWarnings.Error.Error()}
}
res.Warnings = append(res.Warnings, errorAndWarnings.Warnings...)
return res
}