2024-04-18 00:07:12 +00:00
|
|
|
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
|
|
|
|
|
|
|
package source
|
|
|
|
|
|
|
|
import (
|
|
|
|
_ "context"
|
|
|
|
_ "encoding/json"
|
|
|
|
_ "fmt"
|
|
|
|
_ "gopkg.in/yaml.v3"
|
2024-05-24 05:11:51 +00:00
|
|
|
_ "net/url"
|
|
|
|
_ "regexp"
|
2024-04-18 00:07:12 +00:00
|
|
|
_ "strings"
|
2024-05-24 05:11:51 +00:00
|
|
|
_ "os"
|
|
|
|
_ "io"
|
|
|
|
_ "compress/gzip"
|
|
|
|
_ "archive/tar"
|
|
|
|
_ "errors"
|
|
|
|
_ "path/filepath"
|
2024-04-18 00:07:12 +00:00
|
|
|
"decl/internal/resource"
|
2024-05-24 05:11:51 +00:00
|
|
|
_ "decl/internal/codec"
|
2024-04-18 00:07:12 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ResourceSelector func(r resource.Resource) bool
|
|
|
|
|
|
|
|
type DocSource interface {
|
|
|
|
Type() string
|
|
|
|
|
|
|
|
ExtractResources(filter ResourceSelector) ([]*resource.Document, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewDocSource(uri string) DocSource {
|
|
|
|
s, e := SourceTypes.New(uri)
|
|
|
|
if e == nil {
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|