38 lines
620 B
Go
38 lines
620 B
Go
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
|
|
|
package source
|
|
|
|
import (
|
|
_ "context"
|
|
_ "encoding/json"
|
|
_ "fmt"
|
|
_ "gopkg.in/yaml.v3"
|
|
_ "net/url"
|
|
_ "regexp"
|
|
_ "strings"
|
|
_ "os"
|
|
_ "io"
|
|
_ "compress/gzip"
|
|
_ "archive/tar"
|
|
_ "errors"
|
|
_ "path/filepath"
|
|
"decl/internal/resource"
|
|
_ "decl/internal/codec"
|
|
)
|
|
|
|
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
|
|
}
|