core

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsArrayBool

func AsArrayBool(v Any) []bool

func AsArrayEnum

func AsArrayEnum(v Any) [][]any

func AsArrayFloat

func AsArrayFloat(v Any) []float64

func AsArrayInt

func AsArrayInt(v Any) []int64

func AsArrayInterface

func AsArrayInterface(v Any) []interface{}

func AsArrayString

func AsArrayString(v Any) []string

func AsBool

func AsBool(v Any) bool

func AsEnum

func AsEnum(v Any) []any

func AsFloat

func AsFloat(v Any) float64

func AsInt

func AsInt(v any) int64

func AsInterface

func AsInterface(v Any) interface{}

func AsString

func AsString(v Any) string

func MakeSymbolId

func MakeSymbolId(id string, member string) string

func SymbolIdToMember

func SymbolIdToMember(id string) string

func SymbolIdToObjectId

func SymbolIdToObjectId(id string) string

func SymbolIdToParts

func SymbolIdToParts(id string) (string, string)

Types

type Any

type Any any

func AsAny

func AsAny(v Any) Any

type Args

type Args []any

func AsArgs

func AsArgs(v Any) Args

type DataWriter

type DataWriter interface {
	WriteData(data []byte) error
}

type KWArgs

type KWArgs map[string]any

func AsArrayStruct

func AsArrayStruct(v Any) []KWArgs

func AsKwArgs

func AsKwArgs(a Args) KWArgs

func AsProps

func AsProps(v Any) KWArgs

func AsStruct

func AsStruct(v Any) KWArgs

func (KWArgs) Keys

func (a KWArgs) Keys() []string

type Message

type Message []any

func MakeErrorMessage

func MakeErrorMessage(msgType MsgType, id int64, error string) Message

func MakeInitMessage

func MakeInitMessage(objectId string, props KWArgs) Message

func MakeInvokeMessage

func MakeInvokeMessage(requestId int64, methodId string, args Args) Message

func MakeInvokeReplyMessage

func MakeInvokeReplyMessage(requestId int64, methodId string, value Any) Message

func MakeLinkMessage

func MakeLinkMessage(objectId string) Message

func MakePropertyChangeMessage

func MakePropertyChangeMessage(propertyId string, value Any) Message

func MakeSetPropertyMessage

func MakeSetPropertyMessage(propertyId string, value Any) Message

func MakeSignalMessage

func MakeSignalMessage(signalId string, args Args) Message

func MakeUnlinkMessage

func MakeUnlinkMessage(objectId string) Message

func (Message) AsError

func (m Message) AsError() (MsgType, int64, string)

func (Message) AsInit

func (m Message) AsInit() (string, KWArgs)

AsInit returns the name and props of the init message

func (Message) AsInvoke

func (m Message) AsInvoke() (int64, string, Args)

AsInvoke returns the id, name and args of the invoke message message := MsgType, RequestId, MethodId, Args

func (Message) AsInvokeReply

func (m Message) AsInvokeReply() (int64, string, Any)

AsInvokeReply returns the id and result of the invoke reply message := MsgType, RequestId, MethodId, Value

func (m Message) AsLink() string

AsLink returns the name of the link message

func (Message) AsPropertyChange

func (m Message) AsPropertyChange() (string, Any)

AsPropertyChange returns the name and value of the property change message := MsgType, PropertyId, Value

func (Message) AsSetProperty

func (m Message) AsSetProperty() (string, Any)

AsSetProperty returns the name and value of the message message := MsgType, PropertyId, Value

func (Message) AsSignal

func (m Message) AsSignal() (string, Args)

AsSignal returns the name and args of the signal message message := MsgType, SignalId, Args

func (m Message) AsUnlink() string

AsUnlink returns the name of the link message

func (Message) StringType

func (m Message) StringType() string

func (Message) Type

func (m Message) Type() MsgType

type MessageConverter

type MessageConverter struct {
	Format MessageFormat
}

func (*MessageConverter) FromData

func (c *MessageConverter) FromData(data []byte) (Message, error)

func (*MessageConverter) ToData

func (c *MessageConverter) ToData(msg Message) ([]byte, error)

type MessageFormat

type MessageFormat int
const (
	FormatJson    MessageFormat = 1
	FormatBson    MessageFormat = 2
	FormatMsgPack MessageFormat = 3
	FormatCbor    MessageFormat = 4
)

type MockDataWriter

type MockDataWriter struct {
	Messages []Message
	// contains filtered or unexported fields
}

func NewMockDataWriter

func NewMockDataWriter() *MockDataWriter

func (*MockDataWriter) Close

func (w *MockDataWriter) Close() error

func (*MockDataWriter) Write

func (w *MockDataWriter) Write(data []byte) (int, error)

type MsgType

type MsgType int64
const (
	MsgUnknown        MsgType = 0
	MsgLink           MsgType = 10
	MsgInit           MsgType = 11
	MsgUnlink         MsgType = 12
	MsgSetProperty    MsgType = 20
	MsgPropertyChange MsgType = 21
	MsgInvoke         MsgType = 30
	MsgInvokeReply    MsgType = 31
	MsgSignal         MsgType = 40
	MsgError          MsgType = 90
)

func AsMsgType

func AsMsgType(v Any) MsgType

func MsgTypeFromString

func MsgTypeFromString(s string) MsgType

func (MsgType) String

func (t MsgType) String() string

Jump to

Keyboard shortcuts

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