connector

package
v0.7.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Success = NewResult(0, "success")
)

Functions

This section is empty.

Types

type Code

type Code int

type Connector

type Connector interface {
	Initialize(ctx context.Context, cfg config.ConfigAccessor) error
	Name() string
	Destroy() error
}

type HTTPSource added in v0.6.0

type HTTPSource interface {
	Source
	http.Handler
}

type Result

type Result struct {
	// contains filtered or unexported fields
}

func NewResult

func NewResult(c Code, msg string) Result

func (Result) ConvertToCeResult

func (r Result) ConvertToCeResult() ce.Result

func (Result) Error

func (r Result) Error() error

func (Result) GetCode

func (r Result) GetCode() Code

func (Result) GetMsg added in v0.6.0

func (r Result) GetMsg() string

type Sink

type Sink interface {
	Connector
	// Arrived event arrived
	Arrived(ctx context.Context, event ...*ce.Event) Result
}

type Source

type Source interface {
	Connector
	// Chan transform relay data to CloudEvents
	Chan() <-chan *Tuple
}

Source is the interface a source connector expected to implement.

type Tuple

type Tuple struct {
	Event   *ce.Event
	Success func()
	Failed  func(err error)
}

func NewTuple

func NewTuple(event *ce.Event, success func(), failed func(error)) *Tuple

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL