DEFINE TYPE <TypeName> AS <PrimitiveType> [ ALLOWING NULL | NONULL ] | WITH CONSTRAINTS <NumericConstraints> | <TextConstraints> | <EnumerationSet> | <DateConstraints> | <ElapsedTimeConstraints> | <GeoPositionConstraints | <HashValueConstraints>
::= textual name associated with the TYPE
A PrimitiveType is a data type built into the DIDO-CLI. It is characterized as a basic structure for building more sophisticated structures. These PrimitiveTypes are familiar to software engineers and programmers. Note: The PrimitiveTypes have no indication of how the data is stored within the DIDO (ie., Int16
, Int32
, Float
, Double
, Char255
, etc. It is assumed that the “best” underlying type is used for the particular hardware. The Struct primitive type allows for a collection of other Primitive Types to references as a single entity. For example, a NameStruct
might have two Text types for FirstName
and LastName
included in it.
PrimitiveType ::= [ Integer | Fixed | Floating | Text | Enum | Date | Time | Geo | Hash | Object ]
NumericConstraints ::= ( [ MIN = <BaseTypeNumber>, MAX = <BaseTypeNumber>, DEFAULT = <BaseTypeNumber>. UNITS = <UnitsText> [ PRECISION = <SignificateDigits> [, <DecimalPlaces>] VALUE = <BaseTypeNumber> := DEFAULT ] )
DEFINE TYPE PercentType ( VALUE : FIXED, MIN : FIXED := 0.0, MAX : FIXED := 100.00, DEFAULT : FIXED := 50.00, units : TEXT := "percent", PRECISION : TEXT := "5,2" ) AS FIXED ALLOWING NONULL WITH CONSTRAINTS ( VALUE = DEFAULT, MIN = MIN, MAX = MAX, DEFAULT = DEFAULT, UNITS = units, PRECISION = PRECISION, ); CREATE interestRate PercentType = NEW PercentType ( 2.1 );
<code>TextConstraints ::= ( DEFAULT = <TextString> COMPRESSION = <CompressionOptons> ::= [ None | One | OneUnderscore ] CASE = CaseOptions ::= [ Upper | Lower | Mixed | Camel | Title ] MAXLENGTH = <PositiveNumber> ::= [1..n] LENGTH = <PositiveNumber> < MAX_LENGTH; VALUE = <TextString> )</code>
DEFINE TYPE VariableNameType ( DEFAULT Text, compression Text, CASE Text, maxLength I ) AS Text WITH CONSTRAINTS ( DEFAULT = DEFAULT, COMPRESION = ONEUNDERSCORE, CASE = TITLE, MAX_LENGTH = 30, ); CREATE variableName VariableNameType = "My Variable Name";
EnumerationSet ::= ( {( <NumericValue> , <TextValue> ) [, <DescriptiveText> ] }, [ DEFAULT = <NumericValue> [, VALUE = <NumericValue>]])
DEFINE TYPE NetworkProtocolType AS ENUM WITH CONSTRAINTS { { 20 , FTP, "File Transfer Protocol"}, { 22 , SSH, "Secure Shell"} DEFAULT, { 23 , Telnet, "Telnet"}, { 25 , SMTP, "Simple Mail Transfer Protocol"}, { 53 , DNS, "Domain Name Service"}, { 69 , TFTP, "Trivial File Transfer Protocol" }, { 80 , HTTP, "Hypertext Transfer Protocol" }, { 110 , POP3, "Post Office Protocol version 3" }, { 119 , NNTP, "Network News Transport Protocol" }, { 123 , NTP, "Network Time Protocol" }, { 143 , IMAP4, "Internet Message Access Protocol version 4" }, { 443 , HTTPS, "Hypertext Transfer Protocol Secure" } ) VALUE = DEFAULT; CREATE networkProtocol_1.TextValue NetworkProtocolType = FTP; CREATE networkProtocol_2.NumericValue NetworkProtocolType = 20; CREATE description Text = networkProtocol_1.DescriptiveText;
DateConstraints ::= ( DEFAULT = [ <DateTimeValue> | CURRENT_DATE | UNKNOWN ], START = [ <DateTimeValue> | CURRENT_DATE | UNKNOWN ], END = [ <DateTimeValue> | + <DateIncementer | UNKNOWN ], VALUE = <DateTimeValue> := DEFAULT )
DEFINE TYPE ErrorTimeType AS DATE WITH CONSTRAINTS ( DEFAULT = CURRENT_DATE, START = CURRENT_DATE, END = UNKNOWN, VALUE = <DateTimeValue> := DEFAULT ); DECLARE errorTime ErrorTimeType = CURRENT_DATE; dateIncementer DateIncementer = (3,"day"); BEGIN errorTime(END) =+ dateIncementer; END;
ElapsedTimeConstraints ::= ( DEFAULT = [ <TimeValue> | CURRENT_TIME | UNKNOWN ], START = [ <TimeValue> | CURRENT_TIME | UNKNOWN ], END = [ <TimeValue> | + <TimeIncementer | UNKNOWN ], VALUE = <TimeValue> := DEFAULT )
DEFINE TYPE TestTimeType AS DATE WITH CONSTRAINTS ( DEFAULT = CURRENT_DATE, START = CURRENT_DATE, END = UNKNOWN ); DECLARE testTime TestTimeType; BEGIN END;
GeoPositionConstraints::= ( DEFAULT = ( [ <LatitudeValue>, <LongitudeValue>, [, <ElevationValue>] | [ CURRENT_POSITION] ]), VALIDATION = ( [GEOGRAPHIC_FUNCTION [ ( {Parm} ] ]), VALUE = ( <LatitudeValue>, <LongitudeValue>, [, <ElevationValue>] ) := DEFAULT )
DEFINE TYPE GeoPositionType AS HASH WITH CONSTRAINTS ( DEFAULT = CURRENT_POSITION, VALID = LIB.ValidateLatLong ( LatitudeValue, LongitudeValue, ElevationValue ) VALUE = ( 51.476852, -0.000500, 6 ) -- Greenwich, UK ); DECLARE geoPosition GeoPositionType := (33.11129821001457, -117.1563430866643, 4,421); -- Mount Whitney BEGIN END;
HashValueConstraints ::= ( ALGORITHM = [ <HashFunctionName> | DEFAULT_ALGORITHM ], MESSAGE = <MessageText>, OPTIONS = [ "Hex" | "binary" | "base64" ], VALUE = <HexText> )
DEFINE TYPE CryptoKeyType AS HASH WITH CONSTRAINTS ( DEFAULT = "SHA-256",\ MESSAGE = "This is the text used to generate my key", OPTIONS = "hex" ); DECLARE cryptoKey CryptoKeyType ( MESSAGE = "Use this text to generate my key"); BEGIN END;
StructConstraints ::= ( {PrimitiveType} )
::= ( { <IndexType> [.. <IndexType>][,]} )