rngo

Reference

Expressions

Expressions maybe be specified in the rngo JSON schema extension to generate realistic values for static schema. See the Streams reference for more.

API

Prelude

An entry point to the simulation domain. Its methods may be referenced in expressions without explicit qualification.

MethodReturnsNotes
.streamsObject[Stream]A map of every stream in the workspace, keyed by its name.
.enumsObject[Set]A map of all enums provided by rngo. See Enums for more.
.simSimulationThe current simulation context.

Stream

The state of a stream at the current point in the simulation. Stream extends Set so you can also call Set methods on a Stream instance.

Example: The set of all id values in the posts stream

stream.posts.last.id
MethodReturnsNotes
.firstValue | NullThe first value generated by the stream, if any.
.lastValue | NullThe last value generated by the stream, if any.

Set

A collection of Values, that is potentially very large. Commonly used to specify rngo.value in a schema.

Example: A random value in the fullName enum

enum.fullName.random
MethodReturnsNotes
.randomValue | NullReturns a random value from the set, or null if empty.

Simulation

Information about the current state of the simulation.

Example: The current time in the simulation

sim.now
MethodReturnsNotes
.nowTimestampThe current UTC time within the simulation.

Data Types

Value

Any value generated by a stream. It is a recursive union type with any of the following variants:

Array

An ordered collection, generic over type T.

MethodReturnsNotes
[{index}]T | NullReturns the value at the specified integer index, if ones exists.

Object

An associated array, generic over value type T.

MethodReturnsNotes
.{property}T | NullReturns the value of a named property, if it exists.

Boolean

Either true or false.

Null

A value that represents the absence of a value.

Number

An integer or floating point number.

String

A sequence of Unicode characters.

Timestamp

An ISO 8901 UTC timestamp.

MethodReturnsNotes
.stringStringThe ISO 8901 representation of the timestamp.
Previous
Enums