Documentation
¶
Overview ¶
Package sanitize provides a Scrapper decorator that strips NUL bytes and repairs invalid UTF-8 in every row returned by the underlying scrapper. Downstream systems (Postgres text columns, JSON encoders, protobuf text fields) reject these byte sequences, so every scrapper should be wrapped at construction.
Index ¶
- type SanitizingScrapper
- func (s *SanitizingScrapper) Capabilities() scrapper.Capabilities
- func (s *SanitizingScrapper) Close() error
- func (s *SanitizingScrapper) DialectType() string
- func (s *SanitizingScrapper) IsPermissionError(err error) bool
- func (s *SanitizingScrapper) QueryCatalog(ctx context.Context) ([]*scrapper.CatalogColumnRow, error)
- func (s *SanitizingScrapper) QueryCustomMetrics(ctx context.Context, sql string, args ...any) ([]*scrapper.CustomMetricsRow, error)
- func (s *SanitizingScrapper) QueryDatabases(ctx context.Context) ([]*scrapper.DatabaseRow, error)
- func (s *SanitizingScrapper) QuerySegments(ctx context.Context, sql string, args ...any) ([]*scrapper.SegmentRow, error)
- func (s *SanitizingScrapper) QueryShape(ctx context.Context, sql string) ([]*scrapper.QueryShapeColumn, error)
- func (s *SanitizingScrapper) QuerySqlDefinitions(ctx context.Context) ([]*scrapper.SqlDefinitionRow, error)
- func (s *SanitizingScrapper) QueryTableConstraints(ctx context.Context) ([]*scrapper.TableConstraintRow, error)
- func (s *SanitizingScrapper) QueryTableMetrics(ctx context.Context, lastMetricsFetchTime time.Time) ([]*scrapper.TableMetricsRow, error)
- func (s *SanitizingScrapper) QueryTables(ctx context.Context, opts ...scrapper.QueryTablesOption) ([]*scrapper.TableRow, error)
- func (s *SanitizingScrapper) SqlDialect() sqldialect.Dialect
- func (s *SanitizingScrapper) ValidateConfiguration(ctx context.Context) (warnings []string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SanitizingScrapper ¶
type SanitizingScrapper struct {
// contains filtered or unexported fields
}
func NewSanitizingScrapper ¶
func NewSanitizingScrapper(inner scrapper.Scrapper) *SanitizingScrapper
NewSanitizingScrapper wraps inner so that every returned row has its string fields cleaned via each row type's Sanitize() method. Clean strings are returned unchanged with zero allocation, so the overhead on well-formed data is negligible.
func (*SanitizingScrapper) Capabilities ¶
func (s *SanitizingScrapper) Capabilities() scrapper.Capabilities
func (*SanitizingScrapper) Close ¶
func (s *SanitizingScrapper) Close() error
func (*SanitizingScrapper) DialectType ¶
func (s *SanitizingScrapper) DialectType() string
func (*SanitizingScrapper) IsPermissionError ¶
func (s *SanitizingScrapper) IsPermissionError(err error) bool
func (*SanitizingScrapper) QueryCatalog ¶
func (s *SanitizingScrapper) QueryCatalog(ctx context.Context) ([]*scrapper.CatalogColumnRow, error)
func (*SanitizingScrapper) QueryCustomMetrics ¶
func (s *SanitizingScrapper) QueryCustomMetrics(ctx context.Context, sql string, args ...any) ([]*scrapper.CustomMetricsRow, error)
func (*SanitizingScrapper) QueryDatabases ¶
func (s *SanitizingScrapper) QueryDatabases(ctx context.Context) ([]*scrapper.DatabaseRow, error)
func (*SanitizingScrapper) QuerySegments ¶
func (s *SanitizingScrapper) QuerySegments(ctx context.Context, sql string, args ...any) ([]*scrapper.SegmentRow, error)
func (*SanitizingScrapper) QueryShape ¶
func (s *SanitizingScrapper) QueryShape(ctx context.Context, sql string) ([]*scrapper.QueryShapeColumn, error)
func (*SanitizingScrapper) QuerySqlDefinitions ¶
func (s *SanitizingScrapper) QuerySqlDefinitions(ctx context.Context) ([]*scrapper.SqlDefinitionRow, error)
func (*SanitizingScrapper) QueryTableConstraints ¶
func (s *SanitizingScrapper) QueryTableConstraints(ctx context.Context) ([]*scrapper.TableConstraintRow, error)
func (*SanitizingScrapper) QueryTableMetrics ¶
func (s *SanitizingScrapper) QueryTableMetrics(ctx context.Context, lastMetricsFetchTime time.Time) ([]*scrapper.TableMetricsRow, error)
func (*SanitizingScrapper) QueryTables ¶
func (s *SanitizingScrapper) QueryTables(ctx context.Context, opts ...scrapper.QueryTablesOption) ([]*scrapper.TableRow, error)
func (*SanitizingScrapper) SqlDialect ¶
func (s *SanitizingScrapper) SqlDialect() sqldialect.Dialect
func (*SanitizingScrapper) ValidateConfiguration ¶
func (s *SanitizingScrapper) ValidateConfiguration(ctx context.Context) (warnings []string, err error)
Click to show internal directories.
Click to hide internal directories.