Documentation ¶
Index ¶
- Variables
- func GetFieldInformation(t reflect.Type) map[string]any
- func IsComponentValid(component Component, jsonSchemaBytes []byte) (bool, error)
- func SerializeComponentSchema(component Component) ([]byte, error)
- type ArchetypeID
- type Component
- type ComponentID
- type ComponentMetadata
- type EntityID
- type Message
- type MessageID
- type TxHash
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrComponentSchemaMismatch = errors.New("component schema does not match target schema")
Functions ¶
func GetFieldInformation ¶
GetFieldInformation returns a map of the fields of a struct and their types.
func IsComponentValid ¶
Types ¶
type ArchetypeID ¶
type ArchetypeID int
type Component ¶
type Component interface { // Name returns the name of the component. Name() string }
Component is the interface that the user needs to implement to create a new component type.
func ConvertComponentMetadatasToComponents ¶
func ConvertComponentMetadatasToComponents(comps []ComponentMetadata) []Component
ConvertComponentMetadatasToComponents Cast an array of ComponentMetadata into an array of Component
type ComponentID ¶
type ComponentID int
type ComponentMetadata ¶
type ComponentMetadata interface { // SetID sets the ArchetypeID of this component. It must only be set once SetID(ComponentID) error // ArchetypeID returns the ArchetypeID of the component. ID() ComponentID // New returns the marshaled bytes of the default value for the component struct. New() ([]byte, error) Encode(any) ([]byte, error) Decode([]byte) (Component, error) GetSchema() []byte ValidateAgainstSchema(targetSchema []byte) error Component }
ComponentMetadata wraps the user-defined Component struct and provides functionalities that is used internally in the engine.
type Message ¶
type Message interface { SetID(MessageID) error Name() string // Group returns the group of the message. Group() string // FullName returns the fully qualified name of the message. It is formed by <group_name>.<message_name>. // example: persona.create-persona FullName() string ID() MessageID Encode(any) ([]byte, error) Decode([]byte) (any, error) // DecodeEVMBytes decodes ABI encoded bytes into the message's input type. DecodeEVMBytes([]byte) (any, error) // ABIEncode encodes the given type in ABI encoding, given that the input is the message type's input or output // type. ABIEncode(any) ([]byte, error) // IsEVMCompatible reports if this message can be sent from the EVM. IsEVMCompatible() bool // GetInFieldInformation returns a map of the fields of the message's "In" type and it's field types. GetInFieldInformation() map[string]any }
Click to show internal directories.
Click to hide internal directories.