Entity

An entity is a logical dataset within an application. Depending on how you maintain state, it may correspond to any of the following concepts:

  • table
  • collection
  • namespace
  • bucket
  • relation

For example, the following entity generates a new user-like object roughly once per second:

rate: '1'
stream:
  type: object
  properties:
    name:
      type: person.name
    age:
      type: integer
      minimum: 18

Stream

An entity must specify a stream, which defines the schema and content of its generated data.

See the Stream reference for more details.

Rate

An entity's rate defines how frequently the entity generates a value, in Hertz. By default, this value is 0.00001157, or once per day.

rngo builds in variance, so the observed rate over any sub-interval of the simulation may be higher or lower than the configured one.

The value is an expression so to make the rate increase over time, you could do something like this:

rate: "0.1 + (0.0001 * offset)"
stream:
  ...

The expression is sampled periodically over the course of the simulation, so the rate will change in steps.

Rates will always be adjusted to be greater than or equal to zero and less than 1000 Hz.

Output

An entity's output defines how the entity's data is emitted. By default, output is:

output:
  type: json
stream:
  ...

You may also specify a SQL output:

entities:
  users:
    output:
      type: sql
      table: USER

By default, a sql output will use the entity name as the table name. In the above example, we've set a custom table name

If you specifyoutput for an entity, you may not specifysystem.

System

You can associate an entity with a system like this:

systems:
  mydb:
    output:
      type: sql
    import:
      command: sqlite3 db.sqlite
entities:
  users:
    system:
      type: mydb
      table: USER
    stream:
      ...

Any additional properties will be passed to the system's output. In this example, we've set a custom table name for the sql output.

If you specifysystem for an entity, you may not specifyoutput. For more information, see for more details. Systems.