delegate

package
v0.0.0-...-c64bf0e Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package delegate provides the ability to make function calls between different core packages when an import is not possible.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Domain    string
	Action    string
	RawParams []byte
}

Data represents an event between core domains.

func (Data) String

func (d Data) String() string

String implements the Stringer interface.

type Delegate

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

Delegate manages the set of functions to be called by core packages when an import is not possible.

func New

func New(log *logger.Logger) *Delegate

New constructs a delegate for indirect api access.

func (*Delegate) Call

func (d *Delegate) Call(ctx context.Context, data Data) error

Call executes all functions registered for the specified domain and action. These functions are executed synchronously on the G making the call.

func (*Delegate) Register

func (d *Delegate) Register(domainType string, actionType string, fn Func)

Register adds a function to be called for a specified domain and action.

type Func

type Func func(context.Context, Data) error

Func represents a function that is registered and called by the system.

Jump to

Keyboard shortcuts

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