GroupDSL

io.github.positionpal.group.GroupDSL
object GroupDSL

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
GroupDSL.type

Members list

Extensions

Extensions

extension [I, O](group: GroupOps[I, O])
def +(client: (I, O)): Either[ErrorCode[I], GroupOps[I, O]]

Add a client to the group

Add a client to the group

Value parameters

client

A Pair that consist of an identifier and the client

Attributes

Returns

an Either object containing an error code of the operation or the updated group

def -(id: I): Either[ErrorCode[I], GroupOps[I, O]]

Remove a clients from the group

Remove a clients from the group

Value parameters

id

The identifier of the client

Attributes

Returns

an Either object containing an error code of the operation or the updated group

def ?(id: I): Either[ErrorCode[I], O]

Return a client reference that is currently inside the group

Return a client reference that is currently inside the group

Value parameters

id

the id of the client

Attributes

Returns

An Either object indicating an error for the retrieval or the actual reference

def ?>[R](id: I)(cond: O => Boolean)(ifTrue: O => R)(ifFalse: O => R): Either[ErrorCode[I], R]

Execute an action on a client if it belongs to the group and a specific condition is met

Execute an action on a client if it belongs to the group and a specific condition is met

Type parameters

R

The expected return value type

Value parameters

condition

A function that takes a client as input and return a Boolean

id

The client identifier

ko

The function that is executed if the condition returns false

ok

The function that is executed if the condition returns true

Attributes

Returns

An Either object with an error occurred or the result of the function

def |>[R](id: I)(f: O => R): Either[ErrorCode[I], R]

Executes a function on a client if it exists in the group

Executes a function on a client if it exists in the group

Type parameters

R

The expected return value type

Value parameters

f

The function that is executed if the client exists

id

The client identifier

Attributes

Returns

An Either object with an error occurred or the result of the function

def |>>(f: O => Unit): Unit

Execute an action on the output reference for a client

Execute an action on the output reference for a client

Value parameters

f

The function that must be executed for each client

Attributes

infix def ~>(id: I)(f: O => O): Either[ErrorCode[I], GroupOps[I, O]]

Update a client inside the group

Update a client inside the group

Value parameters

f

the update function for the

id

the id of the client

Attributes