-
Notifications
You must be signed in to change notification settings - Fork 41
Updating code generating scripts
All the scripts and input files can be found in Swift-Kuery/Scripts
.
The file runScripts.h
contains the script to run all the code generating scripts for Swift-Kuery. Add a new script here in order to run it with:
$ Scripts/runScripts.h
-
simpleOperators.sh
generates global operators for simple conditions (listed inSimpleOperators.txt
) that return Filter and Having clauses. The fileFilterAndHavingTypes.txt
contains the list of all the types: each line is (Filter/Having, LHS type, RHS type) - the rest is ignored. A special case here is Bool, that can be used only for equals/not equals operators, therefore, there are different input files for Bool:FilterAndHavingBoolOperators.txt
andFilterAndHavingBoolTypes.txt
. The generated code is inSources/SwiftKuery/FilterAndHaving_GlobalFunctions.swift
. -
columnExtensions.sh
generates extensions for Column, ScalarColumnExpression and AggregateColumnExpression for (NOT)LIKE, (NOT)BETWEEN, and (NOT)IN operators. The pairs of (Filter/Having, type to extend) are inColumnExtensionClauses.txt
. The fileColumnExtensionOperands.txt
contains the types of the operands for (NOT)BETWEEN, and (NOT)IN operators. The generated code is inSources/SwiftKuery/ColumnAndExpressions_Extensions.swift
. -
specialOperators.sh
contains the code for the same operators ascolumnExtensions.sh
(i.e., (NOT)LIKE, (NOT)BETWEEN, and (NOT)IN), but the generated extensions are for Int, Double, String, Bool, Float and Parameter (listed inColumnExtensionOperands.txt
). The generated code is inSources/SwiftKuery/SpecialOperators_Extensions.swift
. -
subqueries.sh
generates global operators with subqueries (i.e. 'expression operator ANY/ALL(subquery)'), and extensions for (NOT)IN operator with a subquery. The operators are listed inSimpleOperators.txt
. The types for the operators are inSubqueriesTypes.txt
as (Filter/Having, LHS type (the type of the expression), RHS type (a Filter/HavingPredicate for ANY or ALL applied on a subquery). For (NOT)IN operator types we useInSelectTypes.txt
. The resulting generated code is inSources/SwiftKuery/Subqueries_GlobalFunctionsAndExtensions.swift
. -
filterAndHavingExtensions.sh
generates extensions for Filter and Having for IS (NOT) NULL operators. The generated code is in FilterAndHaving_Extensions.swift -
The following scripts generate tests:
-
testSimpleOperators.sh
tests the code generated bysimpleOperators.sh
using the same input files. The generated test is TestFilterAndHaving.swift. -
testAggregate.sh
tests aggregate functions. It creates TestAggregateFunctions.swift. -
testSpecialOperators.sh
tests the code generated byspecialOperators.sh
using the same input files. The generated test is TestSpecialOperators.swift. -
testSubqueries.sh
tests the code generated bysubqueries.sh
using the same input files. The generated test is TestSubqueries.swift.
-