adapters

package
v0.0.0-...-2f8b938 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCloudEvent

func CreateCloudEvent(request interface{}, eventType, source string) (*cloudevents.Event, error)

CreateCloudEvent takes a JSON byte slice and uses it as the data for a new CloudEvent object Marshaled as a JSON byte slice

func GetRequestFromCloudEvent

func GetRequestFromCloudEvent(msgData []byte) (*cloudevents.Event, error)

GetRequestFromCloudEvent ...

Types

type EventAdapter

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

EventAdapter implements ports.IncomingEventPort

func (*EventAdapter) Init

func (adapter *EventAdapter) Init(conf utils.Config)

Init Initialize the adapter. Establish the STAN connection, obtain STAN related config from utils.Config

func (*EventAdapter) InitChannel

func (adapter *EventAdapter) InitChannel(data chan types.MyDomainDataEvent)

InitChannel takes in the data channel for depositing incoming message

func (EventAdapter) Send

func (adapter EventAdapter) Send(event types.MyDomainDataEvent) error

Send implements ports.OutgoingQueryPort

func (*EventAdapter) Start

func (adapter *EventAdapter) Start()

Start starts the adapter. Starts the subscriber.

type MongoAdapter

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

MongoAdapter ... Implementation of the persistent storage port

func (MongoAdapter) Create

func (c MongoAdapter) Create(d types.MyDomainData) error

func (MongoAdapter) Delete

func (c MongoAdapter) Delete(d types.MyDomainData) error

func (MongoAdapter) Fetch

func (c MongoAdapter) Fetch() []*types.MyDomainData

func (*MongoAdapter) Init

func (c *MongoAdapter) Init(config utils.Config)

Init ... initialize mongodb adapter

func (MongoAdapter) Read

func (MongoAdapter) Update

type QueryAdapter

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

QueryAdapter implements ports.IncomingQueryPort & ports.OutgoingQueryPort

func NewQueryAdapter

func NewQueryAdapter(subject string) *QueryAdapter

NewQueryAdapter creates a new QueryAdapter

func (*QueryAdapter) Init

func (adapter *QueryAdapter) Init(conf utils.Config)

Init perform initialization on the adapter

func (*QueryAdapter) InitChannel

func (adapter *QueryAdapter) InitChannel(c chan types.MyDomainDataQuery)

InitChannel takes in the data channel for depositing incoming message

func (QueryAdapter) Reply

func (adapter QueryAdapter) Reply(msg *nats.Msg, response types.MyDomainData) error

Reply replys a NATS msg with a response Alternative, this could also depoisit the response to an internal go channel

func (QueryAdapter) Send

func (adapter QueryAdapter) Send(queryOp types.QueryOp, data interface{}) error

Send implements ports.OutgoingQueryPort

func (*QueryAdapter) Start

func (adapter *QueryAdapter) Start()

Start starts the queue subscriber

type QueryReply

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

QueryReply implements types.QueryReply

func (QueryReply) Reply

func (r QueryReply) Reply(response types.MyDomainData) error

Reply send a response

Jump to

Keyboard shortcuts

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