41 lines
804 B
Go
41 lines
804 B
Go
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
|
|
|
package data
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
var (
|
|
ErrUnsupportedConversion = errors.New("Unsupported conversion")
|
|
)
|
|
|
|
// Convert a resource to a document and a document to a resource
|
|
|
|
type Emitter interface {
|
|
Emit(document Document, filter ElementSelector) (Resource, error)
|
|
}
|
|
|
|
type Extractor interface {
|
|
Extract(resource Resource, filter ElementSelector) (Document, error)
|
|
}
|
|
|
|
type Converter interface {
|
|
Typer
|
|
Emitter
|
|
Extractor
|
|
Close() error
|
|
}
|
|
|
|
type ManyExtractor interface {
|
|
ExtractMany(resource Resource, filter ElementSelector) ([]Document, error)
|
|
}
|
|
|
|
type ManyEmitter interface {
|
|
EmitMany(documents []Document, filter ElementSelector) (Resource, error)
|
|
}
|
|
|
|
type DirectoryConverter interface {
|
|
SetRelative(flag bool)
|
|
}
|