navidrome/plugins/cmd/hostgen/testdata/ping_expected.go
Deluan de90e191bb feat(hostgen): add hostgen tool for generating Extism host function wrappers
- Implemented hostgen tool to generate wrappers from annotated Go interfaces.
- Added command-line flags for input/output directories and package name.
- Introduced parsing and code generation logic for host services.
- Created test data for various service interfaces and expected generated code.
- Added documentation for host services and annotations for code generation.
- Implemented SubsonicAPI service with corresponding generated code.
2025-12-31 17:06:28 -05:00

34 lines
766 B
Go

// Code generated by hostgen. DO NOT EDIT.
package testpkg
import (
"context"
extism "github.com/extism/go-sdk"
)
// RegisterPingHostFunctions registers Ping service host functions.
// The returned host functions should be added to the plugin's configuration.
func RegisterPingHostFunctions(service PingService) []extism.HostFunction {
return []extism.HostFunction{
newPingPingHostFunction(service),
}
}
func newPingPingHostFunction(service PingService) extism.HostFunction {
return extism.NewHostFunctionWithStack(
"ping_ping",
func(ctx context.Context, p *extism.CurrentPlugin, stack []uint64) {
// Call the service method
err := service.Ping(ctx)
if err != nil {
return
}
},
[]extism.ValueType{},
[]extism.ValueType{},
)
}