Header menu logo Falco.UnionRoutes

OverridablePreCondition<'T> Type

Marks a route field as a precondition that child routes can skip.

Use this ONLY when you need child routes to optionally skip the precondition. For most cases, use PreCondition instead.

Child routes skip with [<SkipAllPreconditions>] or [<SkipPrecondition(typeof<T>)>].

When skipped, the field contains a default value - use _ pattern to ignore it.

Example

 type ItemRoute =
     | List                                  // Inherits parent's OverridablePreCondition
     | [<SkipAllPreconditions>] Public       // Skips it - no auth required

 type Route =
     | Items of OverridablePreCondition<UserId> * ItemRoute

 // In handler, use _ to ignore skipped preconditions:
 match route with
 | Items (_, Public) -> handlePublic ()
 | Items (OverridablePreCondition userId, List) -> handleList userId
type ItemRoute = | List | Public
Multiple items
module List from Microsoft.FSharp.Collections

--------------------
type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T with get member IsEmpty: bool with get member Item: index: int -> 'T with get ...
type Route = | Items of obj * ItemRoute
union case ItemRoute.Public: ItemRoute
union case Route.Items: obj * ItemRoute -> Route
val userId: obj
Multiple items
union case ItemRoute.List: ItemRoute

--------------------
module List from Microsoft.FSharp.Collections

--------------------
type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T with get member IsEmpty: bool with get member Item: index: int -> 'T with get ...

Union cases

Union case Description

OverridablePreCondition 'T

Full Usage: OverridablePreCondition 'T

Parameters:
    Item : 'T

Item : 'T

Type something to start searching.