types

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Example (Printer)
package main

import (
	"context"
	"time"

	"github.com/go-logr/logr"

	"github.com/LeKovr/mqbridge/types"
)

func main() {
	ctx, cancel := context.WithCancel(context.Background())
	epa := types.NewBlankEndPointAttr(ctx)
	pipe := make(chan string)

	go epa.Printer(logr.Discard(), pipe)
	pipe <- "test row"
	time.Sleep(100 * time.Millisecond)
	cancel()
	epa.WG.Wait()
}
Output:

test row

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndPoint

type EndPoint interface {
	// Listen holds signature for Listen func which starts listening goroutine
	Listen(id int, channel string, pipe chan string) error

	// Notify holds signature for Notify func which starts notify goroutine
	Notify(id int, channel string, pipe chan string) error
}

EndPoint declares plugin interface

type EndPointAttr added in v0.3.1

type EndPointAttr struct {
	Log   logr.Logger
	WG    *sync.WaitGroup
	Ctx   context.Context
	Abort chan string
}

EndPointAttr holds common endpoint attributes

func NewBlankEndPointAttr added in v0.3.1

func NewBlankEndPointAttr(ctx context.Context) EndPointAttr

NewBlankEndPointAttr creates new EndPointAttr for testing purposes func NewBlankEndPointAttr(ctx context.Context) EndPointAttr {

func (EndPointAttr) Printer added in v0.3.1

func (ep EndPointAttr) Printer(log logr.Logger, pipe chan string)

Printer prints pipe lines to STDOUT

Jump to

Keyboard shortcuts

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