Enum Types

> Define named sets of allowed values for type-safe selections.

An enum (short for enumeration) is a type that restricts a value to one of a predefined set of options. Enums are useful when a pin should only accept specific, known values -- like a status field that can only be "active", "inactive", or "pending".

Wire color: Purple (#a855f7)

Enum type format

Enum types use the format enum-value:EnumName. The enum name identifies which set of allowed values applies.

For example:

  • enum-value:HttpMethod -- One of GET, POST, PUT, DELETE
  • enum-value:SortOrder -- One of ASC, DESC
  • enum-value:Status -- A custom enum you define

Standard enums

Brickr includes built-in enums for common use cases. These are available in every workspace without any setup.

| Enum Name | Values | |-----------|--------| | HttpMethod | GET, POST, PUT, DELETE, PATCH | | SortOrder | ASC, DESC | | ContentType | application/json, text/plain, text/html, multipart/form-data |

Standard enums are maintained by Brickr and cannot be modified. They are always available in the Builder.

Custom enums

You can create your own enums to match your application's domain.

Creating a custom enum

1. Navigate to your workspace settings or the type editor. 2. Define a new enum with a name and a list of values. 3. The enum is immediately available as a pin type in the Builder.

Example

An e-commerce application might define:

| Enum Name | Values | |-----------|--------| | OrderStatus | pending, processing, shipped, delivered, cancelled | | PaymentMethod | credit_card, paypal, bank_transfer | | ProductCategory | electronics, clothing, food, books |

Using enums in flows

When a node has an enum-typed input, the Builder shows a dropdown with all allowed values. You cannot type a free-text value -- you must select from the predefined list.

This prevents typos and ensures consistency. For example, a Branch node checking an order status will always compare against valid values.

Enum arrays

Enums can also be used as arrays: enum-value:OrderStatus:array. This represents a list of enum values, such as a filter for multiple statuses.

Enums in database columns

Database columns can use the Enum_Array type to store lists of enum values. When you set up a column with an enum type, the table editor shows dropdowns for selecting values.

Use enums anywhere you would otherwise use a string with a limited set of valid values. They make your flows self-documenting and prevent invalid data from entering your system.

What's next?

| Topic | Description | |-------|-------------| | Primitives | String, number, boolean | | Objects | Object types and structures | | Arrays | Working with lists | | Type System Overview | How types work in Brickr |