30 lines
371 B
Go
30 lines
371 B
Go
|
package extractor
|
||
|
|
||
|
import (
|
||
|
"io"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
type Source interface {
|
||
|
URL() string
|
||
|
String() string
|
||
|
Reader() io.Reader
|
||
|
}
|
||
|
|
||
|
type source struct {
|
||
|
sourceUrl string
|
||
|
content string
|
||
|
}
|
||
|
|
||
|
func (s source) URL() string {
|
||
|
return s.sourceUrl
|
||
|
}
|
||
|
|
||
|
func (s source) String() string {
|
||
|
return s.content
|
||
|
}
|
||
|
|
||
|
func (s source) Reader() io.Reader {
|
||
|
return strings.NewReader(s.content)
|
||
|
}
|