feedkit: split the former maximumdirect.net/weatherd project in two.
feedkit now contains a reusable core, while weatherfeeder is a concrete implementation that includes weather-specific functions.
This commit is contained in:
30
sinks/file.go
Normal file
30
sinks/file.go
Normal file
@@ -0,0 +1,30 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user