You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
464 B
34 lines
464 B
package loader
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"gitoa.ru/go-4devs/templating/render"
|
|
)
|
|
|
|
var ErrNotFound = errors.New("not found")
|
|
|
|
type Loader interface {
|
|
Load(ctx context.Context, r render.Reference) (Source, error)
|
|
}
|
|
|
|
func NewSource(name, data string) Source {
|
|
return Source{
|
|
name: name,
|
|
data: data,
|
|
}
|
|
}
|
|
|
|
type Source struct {
|
|
name string
|
|
data string
|
|
}
|
|
|
|
func (s Source) Name() string {
|
|
return s.name
|
|
}
|
|
|
|
func (s Source) Data() string {
|
|
return s.data
|
|
}
|
|
|