-
Notifications
You must be signed in to change notification settings - Fork 1
/
source.go
60 lines (48 loc) · 1.22 KB
/
source.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package connectorName
import (
"context"
sdk "github.com/conduitio/conduit-connector-sdk"
)
type Source struct {
sdk.UnimplementedSource
config SourceConfig
lastPositionRead sdk.Position //nolint:unused // this is just an example
}
func NewSource() sdk.Source {
return &Source{}
}
func (s *Source) Parameters() map[string]sdk.Parameter {
return map[string]sdk.Parameter{
GlobalConfigParam: {
Default: "localhost:10000",
Required: true,
Description: "The URL of the server.",
},
SourceConfigParam: {
Default: "false",
Required: false,
Description: "An optional configuration parameter.",
},
}
}
func (s *Source) Configure(ctx context.Context, cfg map[string]string) error {
sdk.Logger(ctx).Info().Msg("Configuring a Source Connector...")
config, err := ParseSourceConfig(cfg)
if err != nil {
return err
}
s.config = config
return nil
}
func (s *Source) Open(ctx context.Context, pos sdk.Position) error {
return nil
}
func (s *Source) Read(ctx context.Context) (sdk.Record, error) {
return sdk.Record{}, nil
}
func (s *Source) Ack(ctx context.Context, position sdk.Position) error {
return nil
}
func (s *Source) Teardown(ctx context.Context) error {
return nil
}