Documentation
¶
Overview ¶
CRC: crc-BackendConnection.md Spec: libraries.md Package uiclient provides a client library for connecting to UI server.
CRC: crc-PathNavigator.md Spec: protocol.md, libraries.md
Index ¶
- type Connection
- func (c *Connection) Connect(socketPath string) error
- func (c *Connection) Create(parentID int64, value interface{}, props map[string]string) (int64, error)
- func (c *Connection) Destroy(id int64) error
- func (c *Connection) Disconnect() error
- func (c *Connection) Get(ids ...int64) ([]interface{}, error)
- func (c *Connection) GetSessionID() string
- func (c *Connection) IsConnected() bool
- func (c *Connection) OnClose(fn func())
- func (c *Connection) Poll(wait string) (*Response, error)
- func (c *Connection) Send(msg *Message) (*Response, error)
- func (c *Connection) SetRootValue(value interface{}) error
- func (c *Connection) SetSessionID(id string)
- func (c *Connection) Unwatch(id int64) error
- func (c *Connection) Update(id int64, value interface{}, props map[string]string) error
- func (c *Connection) Watch(id int64) error
- type Message
- type PathNavigator
- func (n *PathNavigator) ParsePath(path string) []Segment
- func (n *PathNavigator) RegisterStandardVariable(name string, value interface{})
- func (n *PathNavigator) Resolve(root interface{}, path string) (interface{}, error)
- func (n *PathNavigator) ResolveForWrite(root interface{}, path string) (parent interface{}, key string, index int, err error)
- type Response
- type Segment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection represents a connection to the UI server.
func NewConnection ¶
func NewConnection() *Connection
NewConnection creates a new UI server connection.
func (*Connection) Connect ¶
func (c *Connection) Connect(socketPath string) error
Connect establishes connection to the UI server. socketPath is the Unix socket or named pipe path.
func (*Connection) Create ¶
func (c *Connection) Create(parentID int64, value interface{}, props map[string]string) (int64, error)
Create creates a new variable.
func (*Connection) Destroy ¶
func (c *Connection) Destroy(id int64) error
Destroy destroys a variable.
func (*Connection) Disconnect ¶
func (c *Connection) Disconnect() error
Disconnect closes the connection.
func (*Connection) Get ¶
func (c *Connection) Get(ids ...int64) ([]interface{}, error)
Get retrieves variable values.
func (*Connection) GetSessionID ¶
func (c *Connection) GetSessionID() string
GetSessionID returns the current session ID.
func (*Connection) IsConnected ¶
func (c *Connection) IsConnected() bool
IsConnected returns the connection state.
func (*Connection) OnClose ¶
func (c *Connection) OnClose(fn func())
OnClose registers a callback for connection close.
func (*Connection) Poll ¶
func (c *Connection) Poll(wait string) (*Response, error)
Poll retrieves pending messages.
func (*Connection) Send ¶
func (c *Connection) Send(msg *Message) (*Response, error)
Send sends a message to the UI server.
func (*Connection) SetRootValue ¶
func (c *Connection) SetRootValue(value interface{}) error
SetRootValue initializes variable 1 with a root value.
func (*Connection) SetSessionID ¶
func (c *Connection) SetSessionID(id string)
SetSessionID sets the session ID.
func (*Connection) Unwatch ¶
func (c *Connection) Unwatch(id int64) error
Unwatch unsubscribes from variable updates.
func (*Connection) Update ¶
func (c *Connection) Update(id int64, value interface{}, props map[string]string) error
Update updates a variable.
func (*Connection) Watch ¶
func (c *Connection) Watch(id int64) error
Watch subscribes to variable updates.
type Message ¶
type Message struct {
Type string `json:"type"`
ID int64 `json:"id,omitempty"`
ParentID int64 `json:"parentId,omitempty"`
Value interface{} `json:"value,omitempty"`
Properties map[string]string `json:"properties,omitempty"`
VarIDs []int64 `json:"varIds,omitempty"`
ObjIDs []int64 `json:"objIds,omitempty"`
Wait string `json:"wait,omitempty"`
Nowatch bool `json:"nowatch,omitempty"`
Unbound bool `json:"unbound,omitempty"`
}
Message represents a protocol message.
type PathNavigator ¶
type PathNavigator struct {
// contains filtered or unexported fields
}
PathNavigator handles path resolution for variable bindings.
func NewPathNavigator ¶
func NewPathNavigator() *PathNavigator
NewPathNavigator creates a new path navigator.
func (*PathNavigator) ParsePath ¶
func (n *PathNavigator) ParsePath(path string) []Segment
ParsePath splits a path string into segments.
func (*PathNavigator) RegisterStandardVariable ¶
func (n *PathNavigator) RegisterStandardVariable(name string, value interface{})
RegisterStandardVariable registers a @name variable.
func (*PathNavigator) Resolve ¶
func (n *PathNavigator) Resolve(root interface{}, path string) (interface{}, error)
Resolve navigates a path to get a value.
func (*PathNavigator) ResolveForWrite ¶
func (n *PathNavigator) ResolveForWrite(root interface{}, path string) (parent interface{}, key string, index int, err error)
ResolveForWrite navigates and returns parent + key for setting.