feedkit now contains a reusable core, while weatherfeeder is a concrete implementation that includes weather-specific functions.
31 lines
600 B
Go
31 lines
600 B
Go
package sinks
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"gitea.maximumdirect.net/ejr/feedkit/config"
|
|
"gitea.maximumdirect.net/ejr/feedkit/event"
|
|
)
|
|
|
|
type FileSink struct {
|
|
name string
|
|
path string
|
|
}
|
|
|
|
func NewFileSinkFromConfig(cfg config.SinkConfig) (Sink, error) {
|
|
path, err := requireStringParam(cfg, "path")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &FileSink{name: cfg.Name, path: path}, nil
|
|
}
|
|
|
|
func (s *FileSink) Name() string { return s.name }
|
|
|
|
func (s *FileSink) Consume(ctx context.Context, e event.Event) error {
|
|
_ = ctx
|
|
_ = e
|
|
return fmt.Errorf("file sink: TODO implement (path=%s)", s.path)
|
|
}
|