1. MooseStack
  2. Data Types
  3. Enum Types

On this page

String EnumsNumeric EnumsSee Also

Enum Types

Enums map to ClickHouse enums, storing categorical values efficiently.

String Enums

enum UserRole {  ADMIN = "admin",  USER = "user",  GUEST = "guest"} enum Status {  PENDING = "pending",  ACTIVE = "active",  INACTIVE = "inactive"} interface User {  role: UserRole;  status: Status;}

Numeric Enums

enum Priority {  LOW = 1,  MEDIUM = 2,  HIGH = 3,  CRITICAL = 4} interface Task {  priority: Priority;}
Storage efficiency

Enums are stored as integers internally, making them more storage-efficient than strings while maintaining readability in queries.

Enum modifications

Adding new enum values is safe, but removing or renaming values requires careful migration planning as it affects existing data.

See Also

  • Strings — When you need arbitrary string values
  • LowCardinality — Alternative for dynamic low-cardinality values
  • ClickHouse Enum — ClickHouse official documentation
FiveonefourFiveonefour
Fiveonefour Docs
MooseStackTemplates
Changelog
Source508
  • Overview
Build a New App
  • 5 Minute Quickstart
  • Browse Templates
  • Existing ClickHouse
Add to Existing App
  • Next.js
  • Fastify
Fundamentals
  • Moose Runtime
  • MooseDev MCP
  • Data Modeling
Moose Modules
  • Moose OLAP
  • Moose Streaming
  • Moose Workflows
  • Moose APIs & Web Apps
Deployment & Lifecycle
  • Moose Migrate
  • Moose Deploy
Reference
  • API Reference
  • Data Types
    • Strings
    • LowCardinality
    • Integers
    • Floats
    • Decimals
    • Booleans
    • Date & Time
    • Network
    • Arrays
    • Maps
    • Nested
    • Tuples
    • Enums
    • Geometry
    • JSON
    • Nullable
    • Aggregates
  • Table Engines
  • CLI
  • Configuration
  • Observability Metrics
  • Help
  • Changelog
Contribution
  • Documentation
  • Framework