or-type
ftd
supports or-type
, which is loosely equivalent of enum
in Rust, and is otherwise known as “algebraic data type”.or-type
Say we have a sales business and we are going to get “leads”, and a lead can be either an individual or a company. In case of individuals we have fields like their name, and phone number. For a company we have company name and the name of contact and the fax number of the company.
An or-type
can be created like this: