Skip to content

Common macros

sdflysha edited this page Feb 10, 2020 · 12 revisions
  • #include

    • #include<OtherQueryNamespace.OtherQueryId>
    • #include<OtherQueryId>
  • #val

    • The query object it self: #val<>
  • #prop

    • Return The property name of the query object: #prop<Id>
    • Nested object is supported: #prop<Location.City>
    • query object support object and IDictionary
  • #iif

    • `#iif<IsVIP, "VIP", "not VIP">
    • unnamed sql in #iff<> is also supported: #iif<IsVIP, sql {VIP}, sql {not VIP}>
  • #hasProp

    • add content if has property: #hasProp<PropertyName, sql {content if has prop}>
  • #isEmpty

  • #isNotEmpty

    • add content if property value is not empty/null: #isNotEmpty<PropertyName, sql {content if has prop}>
    • If property value is array, then zero-length array is evaluated as empty.
    • If property is not defined, a error will be prompted.
  • #isNull

  • #isNotNull

    • add content if has property AND property value is not null: #isNotNull<PropertyName, sql {content if has prop}>
  • #isEqual

    • sql v1{#isEqual<YourPropertyHere, "TheValueYouWantToCompare", sql { SQL Statement here }> }
  • #isNotEqual

  • #isLike

  • #isNotLike

  • #iterate

    • iterate for the query object itself, example: sql v1{#iterate<',', sql{#prop<Id> #prop<Name>}}
  • #each

    • iterate for a property for query object, example: sql v1{#each<A, ',', sql{#prop<Id> #prop<Name>}}
  • #def/#deps

Clone this wiki locally