component

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 10 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

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

func CreateComponent

func CreateComponent(manifest ComponentManifest, fns ...ComponentBindable) *Component

func (*Component) Start

func (c *Component) Start()

func (*Component) StartWithSetup

func (c *Component) StartWithSetup(setup ComponentSetupFn)

type ComponentBindable

type ComponentBindable interface {
	Execute(args []byte, context *ComponentContainer) *ComponentResultPayload
	// contains filtered or unexported methods
}

type ComponentBindableFn

type ComponentBindableFn[I any, O any] = func(input *ComponentInput[I, O], ctx *ComponentContainer) *ComponentReturn[O]

type ComponentContainer

type ComponentContainer struct {
	Storage  core.Storage
	Keychain core.Keychain
	Logger   core.Logger
	// contains filtered or unexported fields
}

func (*ComponentContainer) OpenUrl

func (c *ComponentContainer) OpenUrl(url string) bool

func (*ComponentContainer) RequestOauth

func (c *ComponentContainer) RequestOauth(url, callback string) (string, bool)

func (*ComponentContainer) RequestSecret

func (c *ComponentContainer) RequestSecret(prompt string) (string, bool)

func (*ComponentContainer) Run

func (c *ComponentContainer) Run(program string, args ...string) ComponentExecuteResponse

type ComponentDefinition

type ComponentDefinition[I any, O any] struct {
	// contains filtered or unexported fields
}

func Define

func Define[I any, O any](manifest core.ComponentManifest, name string) *ComponentDefinition[I, O]

func (*ComponentDefinition[I, O]) Execute

func (c *ComponentDefinition[I, O]) Execute(mod core.ForeignComponent, input I) (O, bool)

type ComponentExecuteResponse

type ComponentExecuteResponse struct {
	Ok     bool
	Output string
	Error  string
}

type ComponentFunctionFn

type ComponentFunctionFn = func(body []byte, ctx *ComponentContainer) *ComponentResultPayload

type ComponentInput

type ComponentInput[I any, O any] struct {
	Body I
}

func (*ComponentInput[I, O]) Error

func (c *ComponentInput[I, O]) Error(msg string) *ComponentReturn[O]

func (*ComponentInput[I, O]) Return

func (c *ComponentInput[I, O]) Return(ret O) *ComponentReturn[O]

type ComponentKeychain

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

func (*ComponentKeychain) Get

func (c *ComponentKeychain) Get(k string) string

func (*ComponentKeychain) Set

func (c *ComponentKeychain) Set(k, v string)

type ComponentLogger

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

func (*ComponentLogger) Event

func (cl *ComponentLogger) Event(ev string, payload any)

func (*ComponentLogger) Log

func (cl *ComponentLogger) Log(v string, args ...any)

func (*ComponentLogger) LogLiteral

func (cl *ComponentLogger) LogLiteral(v string)

type ComponentManifest

type ComponentManifest = core.ComponentManifest

type ComponentMount

type ComponentMount[I any, O any] struct {
	Definition *ComponentDefinition[I, O]
	Function   ComponentBindableFn[I, O]
}

func Mount

func Mount[I any, O any](definition *ComponentDefinition[I, O], fn ComponentBindableFn[I, O]) *ComponentMount[I, O]

func (*ComponentMount[I, O]) Execute

func (m *ComponentMount[I, O]) Execute(args []byte, ctx *ComponentContainer) *ComponentResultPayload

type ComponentResultPayload

type ComponentResultPayload = componentipc.ComponentResultPayload

type ComponentReturn

type ComponentReturn[O any] struct {
	Result    O
	Error     string
	Succeeded bool
}

type ComponentSetupFn

type ComponentSetupFn = func(ctx *ComponentContainer) string

type ComponentStorage

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

func (*ComponentStorage) GetBool

func (c *ComponentStorage) GetBool(k string) bool

func (*ComponentStorage) GetDate

func (c *ComponentStorage) GetDate(k string) time.Time

func (*ComponentStorage) GetFloat

func (c *ComponentStorage) GetFloat(k string) float64

func (*ComponentStorage) GetInt

func (c *ComponentStorage) GetInt(k string) int

func (*ComponentStorage) GetString

func (c *ComponentStorage) GetString(k string) string

func (*ComponentStorage) SetDate

func (c *ComponentStorage) SetDate(key string, value time.Time) error

func (*ComponentStorage) SetInt

func (c *ComponentStorage) SetInt(k string, v int) error

func (*ComponentStorage) SetString

func (c *ComponentStorage) SetString(k, v string) error

type ComponentTrigger

type ComponentTrigger[T any] struct {
	ComponentName string
	TriggerName   string
}

func NewComponentTrigger

func NewComponentTrigger[T any](m ComponentManifest, name string) ComponentTrigger[T]

func (*ComponentTrigger[T]) Send

func (c *ComponentTrigger[T]) Send(cc *ComponentContainer, payload T)

Jump to

Keyboard shortcuts

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