metadata

package
v0.13.0-test.4 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MetadataVersion = 2

Variables

View Source
var ErrMetadataNotFound = fmt.Errorf("no metadata found in plugin")

Functions

This section is empty.

Types

type Field

type Field struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type Function

type Function struct {
	Name       string       `json:"-"`
	Parameters []*Parameter `json:"parameters,omitempty"`
	Results    []*Result    `json:"results,omitempty"`
}

func NewFunction

func NewFunction(name string) *Function

func (*Function) String

func (f *Function) String() string

func (*Function) WithNamedResult

func (f *Function) WithNamedResult(name string, typ string) *Function

func (*Function) WithParameter

func (f *Function) WithParameter(name string, typ string, dflt ...any) *Function

func (*Function) WithResult

func (f *Function) WithResult(typ string) *Function

type FunctionMap

type FunctionMap map[string]*Function

func (*FunctionMap) AddFunction

func (m *FunctionMap) AddFunction(name string) *Function

type Metadata

type Metadata struct {
	Plugin    string      `json:"plugin"`
	Module    string      `json:"module"`
	SDK       string      `json:"sdk"`
	BuildId   string      `json:"buildId"`
	BuildTime string      `json:"buildTs"`
	GitRepo   string      `json:"gitRepo,omitempty"`
	GitCommit string      `json:"gitCommit,omitempty"`
	FnExports FunctionMap `json:"fnExports,omitempty"`
	FnImports FunctionMap `json:"fnImports,omitempty"`
	Types     TypeMap     `json:"types,omitempty"`
}

func GetMetadata

func GetMetadata(wasmCustomSections map[string][]byte) (*Metadata, error)

func GetMetadataFromCompiledModule

func GetMetadataFromCompiledModule(cm wazero.CompiledModule) (*Metadata, error)

func GetMetadataFromContext

func GetMetadataFromContext(ctx context.Context) (*Metadata, error)

func NewPluginMetadata

func NewPluginMetadata() *Metadata

func (*Metadata) GetExportedFunctions

func (m *Metadata) GetExportedFunctions() []*Function

func (*Metadata) GetTypeDefinition

func (m *Metadata) GetTypeDefinition(typ string) (*TypeDefinition, error)

func (*Metadata) Name

func (m *Metadata) Name() string

func (*Metadata) NameAndVersion

func (m *Metadata) NameAndVersion() (name string, version string)

func (*Metadata) SdkName

func (m *Metadata) SdkName() string

func (*Metadata) SdkNameAndVersion

func (m *Metadata) SdkNameAndVersion() (name string, version string)

func (*Metadata) SdkVersion

func (m *Metadata) SdkVersion() string

func (*Metadata) Version

func (m *Metadata) Version() string

type Parameter

type Parameter struct {
	Name    string `json:"name"`
	Type    string `json:"type"`
	Default *any   `json:"default,omitempty"`
}

func (*Parameter) String

func (p *Parameter) String() string

func (*Parameter) UnmarshalJSON

func (p *Parameter) UnmarshalJSON(data []byte) error

type Result

type Result struct {
	Name string `json:"name,omitempty"`
	Type string `json:"type"`
}

func (*Result) String

func (r *Result) String() string

type TypeDefinition

type TypeDefinition struct {
	Name   string   `json:"-"`
	Id     uint32   `json:"id,omitempty"`
	Fields []*Field `json:"fields,omitempty"`
}

func (*TypeDefinition) WithField

func (t *TypeDefinition) WithField(name string, typ string) *TypeDefinition

func (*TypeDefinition) WithId

func (t *TypeDefinition) WithId(id uint32) *TypeDefinition

type TypeMap

type TypeMap map[string]*TypeDefinition

func (*TypeMap) AddType

func (m *TypeMap) AddType(name string) *TypeDefinition

Jump to

Keyboard shortcuts

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