Skip to main content

Define an Entity

An Entity is an object (or variable) that has identidy. This means it is unique and can be referenced by other objects using its ID.

To declare an Entity with Bitloops Language, you simply define your entity variable and name, adding an "Entity" suffix:

Entity TitleEntity {
 constructor(props: TodoProps): (OK(TodoEntity), Errors(DomainErrors.InvalidTitleError))
  }

Now, in Bitloops Language specifically, to ensure good coding practice, there is the concept of Root Entity. This is a special type of Entity as its the Entity that can be referenced by other objects in the application.

To declare this type of Entity, you should simply add Root as a prefix:

Root Entity TitleEntity {
 constructor(props: TodoProps): (OK(TodoEntity), Errors(DomainErrors.InvalidTitleError))
  }