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 DebugStateElement
- type EntityID
- type EntityStateElement
- type FieldDetail
- 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")
View Source
var ErrQueryNotFound = eris.New("query not found")
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 DebugStateElement ¶ added in v1.4.1
type DebugStateElement struct {
ID EntityID `json:"id"`
Components map[string]json.RawMessage `json:"components" swaggertype:"object"`
}
type EntityStateElement ¶ added in v1.3.3
type EntityStateElement struct {
ID EntityID `json:"id"`
Data []json.RawMessage `json:"data" swaggertype:"object"`
}
type FieldDetail ¶ added in v1.3.3
type FieldDetail struct {
Name string `json:"name"` // name of the message or query
Fields map[string]any `json:"fields"` // variable name and type
URL string `json:"url,omitempty"`
}
FieldDetail represents a field from a url request.
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.