w2

package module
v0.0.0-...-472d419 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

w2

w2 is a lightweight WASM plugin system prototype in Golang

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CtxKey_Host = CtxKey("host")
)

Functions

This section is empty.

Types

type CallReq

type CallReq struct {
	Method string    `json:"method"`
	Params ParamType `json:"params"`
}

type CallResp

type CallResp struct {
	Result ResultType `json:"result,omitempty"`
	Error  string     `json:"error,omitempty"`
}

type CtxKey

type CtxKey string

type Host

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

func NewHost

func NewHost() *Host

func (*Host) Call

func (h *Host) Call(ctx context.Context, modName string, method string, params ParamType) (ret ResultType, err error)

func (*Host) Init

func (h *Host) Init() error

func (*Host) LoadMod

func (h *Host) LoadMod(ctx context.Context, modName string, modWasmCode []byte) error

type HostFunc

type HostFunc func(param ParamType) (result ResultType, err error)

type ParamType

type ParamType map[string]interface{}

type ResultType

type ResultType interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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