Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event uint32
func (Event) Channel ¶
func (e Event) Channel() (*pubsubNode.ChannelObject, error)
Channel will get the name of the event's channel returns a ChannelObject and an error
Example ¶
package main
import (
"fmt"
symbols "github.com/taubyte/go-sdk-symbols/pubsub/event"
"github.com/taubyte/go-sdk/event"
_ "github.com/taubyte/go-sdk/pubsub/event"
)
func main() {
// Mocking the calls to the vm for usage in tests and playground
symbols.MockData{
Channel: "someChannel",
}.Mock()
// An event that would be received by a taubyte function
var e event.Event
pubSubEvent, err := e.PubSub()
if err != nil {
return
}
channel, err := pubSubEvent.Channel()
if err != nil {
return
}
fmt.Println("Channel:", channel.Name())
}
Output: Channel: someChannel
func (Event) Data ¶
Data will get the data received with the pub-sub event returns a byte slice and an error
Example ¶
package main
import (
"fmt"
symbols "github.com/taubyte/go-sdk-symbols/pubsub/event"
"github.com/taubyte/go-sdk/event"
_ "github.com/taubyte/go-sdk/pubsub/event"
)
func main() {
// Mocking the calls to the vm for usage in tests and playground
symbols.MockData{
EventData: []byte("Hello, world!"),
}.Mock()
// An event that would be received by a taubyte function
var e event.Event
pubSubEvent, err := e.PubSub()
if err != nil {
return
}
data, err := pubSubEvent.Data()
if err != nil {
return
}
fmt.Println("Data:", string(data))
}
Output: Data: Hello, world!
type EventMessage ¶
type EventMessage uint32
Click to show internal directories.
Click to hide internal directories.