[ROOT] / doc / toc / ARCQuery / Class / FunctionKey
AddParser , Parsers , TryGetP , TryParse , TryParseSingleWord
Extracts data from an already existing value like extracting Year from a DateTime in 'Created.Year()'.
This is an expandable concept, that is, you can create your own implementations of this class in your ApplicationSpecificCode.
Often the extraction is actually a simplification of the existing value, like Created.Year() which would for '2020-06-11 13:36' return '2020'.
Implementing classes in StandardAgoRapideCode, more specific ARCQuery, are:
(these are stored in CompoundKey as FunctionKeys.)
and also (see FunctionKeyAggregate):
(these are stored in ForeignKey as AggregateKeys.)
TODO: Add a PK field, describing the value that is returned.
It can also be said to work as a function against a value field, but with the syntax 'value.functionName()' instead of functionName(value).
(See also ValueComparer which can evaluate expressions like 'WHERE Created = ThisYear')
Explanation of the conceptual difference between ValueComparer and FunctionKey:
These two concepts are working from two different 'origins'.
FunctionKey is necessary if you want to pivot around the value (for instance with QueryExpressionPivot).
ValueComparer is more practical if the value can have different interpretations at the same time.
An example is ValueComparerDateTime which understands that 'Created' can be all of 'ThisYear', 'ThisMonth', 'ThisWeek', 'InTheMorning', 'ThisMorning' and so on.
(It would be time consuming to write all the necessary FunctionKey implementations in order to support this. and the query syntax would be more verbose ('Created.YearNumber = ThisYear' or something similar, instead of just 'Created = ThisYear').)
Note that the concept is inherently expandable, you can create your own sub-classes and integrate them with StandardAgoRapideCode.
Note how any ApplicationSpecificCode implementations must be added to Parsers at application startup in order for them to be recognized by TryParse.
|AddParser||Adds a ApplicationSpecificCode parser.|
|Parsers||Instances of all the relevant sub classes of FunctionKey.|
|TryParse||Find parsers from Parsers based on first word in query.|
|TryParseSingleWord||Recommended parser to use for functions without parameters.|
Generated 2023-03-20 10:26:12.070 UTC