Skip to content
scalive
Menu
ConnectingLiveReconnectingOffline
t

LiveParamsDecoder

trait LiveParamsDecoder[PathParams, Params]

Decodes a route's path values and complete URL into parameters for a routed LiveView.

A decoder is intentionally one-way. Routes built with it can consume URLs, but cannot construct a LiveLocation from Params; use LiveParamsCodec when both operations are required.

Type parameters

PathParams

the values decoded by the route's path codec

Params

the parameters supplied to Routed

Defined by scalive.LiveParamsDecoder. View source (scalive/api/src/scalive/LiveParamsCodec.scala:18-52)

Methods2

decode

def decode(pathParams: PathParams, url: zio.http.URL): zio.package.IO[LiveParamsCodec.DecodeError, Params]

Decodes parameters for the current URL.

Parameters

pathParams

the already-decoded path values

url

the complete current URL, including its query and fragment

Returns

Returns

an effect that succeeds with the routed parameters or fails with a normalized decode error

Defined by scalive.LiveParamsDecoder.decode. View source (scalive/api/src/scalive/LiveParamsCodec.scala:28-31)

mapDecodeOnly

def mapDecodeOnly[Params2](decodeParams: Params => Params2): LiveParamsDecoder[PathParams, Params2]

Maps successfully decoded parameters without defining an inverse mapping.

The result remains decode-only even when this decoder was originally a LiveParamsCodec. This is useful for validation or normalization that cannot be reversed, and deliberately removes typed location construction from the resulting route builder.

Parameters

decodeParams

transforms the decoded value; exceptions thrown by this function are defects, not DecodeError values

Returns

Returns

a decoder for the transformed parameter type

Defined by scalive.LiveParamsDecoder.mapDecodeOnly. View source (scalive/api/src/scalive/LiveParamsCodec.scala:45-51)