types

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EventType_name = map[int32]string{
		0: "UNKNOWN",
		1: "CREATE",
		2: "UPDATE",
		3: "DELETE",
	}
	EventType_value = map[string]int32{
		"UNKNOWN": 0,
		"CREATE":  1,
		"UPDATE":  2,
		"DELETE":  3,
	}
)

Enum value maps for EventType.

View Source
var File_types_event_proto protoreflect.FileDescriptor

Functions

func Decode

func Decode(data []byte, c interface{}) (err error)

func EnvOf

func EnvOf(str ...string) []string

func HeaderGet

func HeaderGet(h Header, name string) string

Types

type CfgMap

type CfgMap map[string]interface{}

func (CfgMap) Decode

func (t CfgMap) Decode(dst interface{}) error

type Command

type Command = cli.Command

type Commands added in v0.1.20

type Commands = []cli.Command

type Event

type Event struct {
	// Key sets the key of the message for routing policy
	Key string
	// Payload for the message
	Payload []byte
	// Properties attach application defined properties on the message
	Properties map[string]string
}

Event is an abstraction for all messages that are sent to queue or received from queue.

type EventType

type EventType int32
const (
	EventType_UNKNOWN EventType = 0
	EventType_CREATE  EventType = 1
	EventType_UPDATE  EventType = 2
	EventType_DELETE  EventType = 3
)

func (EventType) Descriptor

func (EventType) Descriptor() protoreflect.EnumDescriptor

func (EventType) Enum

func (x EventType) Enum() *EventType

func (EventType) EnumDescriptor deprecated

func (EventType) EnumDescriptor() ([]byte, []int)

Deprecated: Use EventType.Descriptor instead.

func (EventType) Number

func (x EventType) Number() protoreflect.EnumNumber

func (EventType) String

func (x EventType) String() string

func (EventType) Type

type Flags

type Flags = []cli.Flag

type Handler

type Handler func(context.Context, Event) error

Handler is a callback function that processes messages delivered to asynchronous subscribers.

type Header = metadata.MD

type Healthy

type Healthy func(req *http.Request) error

type L added in v0.1.20

type L = []interface{}

type M

type M = map[string]interface{}

type MiddleNext

type MiddleNext func(ctx context.Context, req Request, resp func(rsp Response) error) error

type Middleware

type Middleware func(next MiddleNext) MiddleNext

type Publisher

type Publisher interface {
	Publish(ctx context.Context, event Event) error
	Close() error
}

Publisher is abstraction for sending messages to queue.

type Request

type Request interface {
	// Client server or client
	Client() bool

	// Kind [http|grpc...]
	Kind() string

	// Service name requested
	Service() string

	// Method The action requested
	Method() string

	// Endpoint name requested
	Endpoint() string

	// ContentType Content type provided
	ContentType() string

	// Header of the request
	Header() Header

	// Codec The encoded message
	Codec() encoding.Codec

	// Payload is the decoded value
	Payload() interface{}

	// Read the encode request body
	Read() ([]byte, error)

	// Stream Indicates whether it's a stream
	Stream() bool
}

Request is a synchronous request interface

type Response

type Response interface {
	Header() Header
	Payload() interface{}
	Stream() bool
}

Response is the response writer for un encoded messages

type Strs

type Strs = []string

type Subscriber

type Subscriber interface {
	Subscribe(ctx context.Context, h Handler) error
	Close() error
}

Subscriber is an abstraction for receiving messages from queue.

type Vars

type Vars func(name string, data func() interface{})

func (Vars) Do

func (v Vars) Do(name string, data func() interface{})

type WatchResp

type WatchResp struct {
	Type    string
	Event   EventType
	Key     string
	Value   []byte
	Version int64
}

func (*WatchResp) Decode

func (t *WatchResp) Decode(c interface{}) error

Decode ...

func (*WatchResp) OnDelete

func (t *WatchResp) OnDelete(fn func())

func (*WatchResp) OnPut

func (t *WatchResp) OnPut(fn func())

type Watcher

type Watcher func(name string, r *WatchResp) error

Jump to

Keyboard shortcuts

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