mirror of
https://github.com/hanzoai/o11y-foundry.git
synced 2026-10-30 18:26:45 +00:00
22 lines
655 B
Go
22 lines
655 B
Go
package patch
|
|
|
|
import (
|
|
"context"
|
|
"path/filepath"
|
|
|
|
"github.com/hanzoai/o11y-foundry/api/v1alpha1"
|
|
"github.com/hanzoai/o11y-foundry/internal/domain"
|
|
)
|
|
|
|
// Patch applies a single patch entry to generated materials.
|
|
type Patch interface {
|
|
// Apply applies a single patch entry to matching materials and returns the patched materials.
|
|
Apply(ctx context.Context, materials []domain.Material, patch v1alpha1.PatchEntry) ([]domain.Material, error)
|
|
}
|
|
|
|
// MatchTarget checks if a material path matches a target pattern.
|
|
// Supports exact paths and glob patterns.
|
|
func MatchTarget(pattern, path string) (bool, error) {
|
|
return filepath.Match(pattern, path)
|
|
}
|