2024-05-06 00:48:54 +00:00
|
|
|
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
|
|
|
|
|
|
|
package target
|
|
|
|
|
|
|
|
import (
|
|
|
|
_ "context"
|
|
|
|
_ "encoding/json"
|
|
|
|
_ "fmt"
|
|
|
|
_ "gopkg.in/yaml.v3"
|
|
|
|
_ "net/url"
|
|
|
|
_ "regexp"
|
|
|
|
_ "strings"
|
|
|
|
_ "os"
|
|
|
|
_ "io"
|
|
|
|
"decl/internal/resource"
|
|
|
|
)
|
|
|
|
|
|
|
|
// convert a document into some other container type
|
|
|
|
|
|
|
|
// move selector to resource pkg
|
|
|
|
// type ResourceSelector func(r resource.Resource) bool
|
|
|
|
|
|
|
|
type DocTarget interface {
|
|
|
|
Type() string
|
|
|
|
|
|
|
|
EmitResources(documents []*resource.Document, filter resource.ResourceSelector) error
|
2024-05-09 08:50:56 +00:00
|
|
|
Close() error
|
2024-05-06 00:48:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewDocTarget(uri string) DocTarget {
|
|
|
|
s, e := TargetTypes.New(uri)
|
|
|
|
if e == nil {
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|