Package

io.getquill

norm

Permalink

package norm

Visibility
  1. Public
  2. All

Type Members

  1. case class BetaReduction(map: Map[Ast, Ast]) extends StatelessTransformer with Product with Serializable

    Permalink
  2. trait ConcatBehavior extends AnyRef

    Permalink
  3. class FlattenOptionOperation extends StatelessTransformer

    Permalink

Value Members

  1. object AdHocReduction

    Permalink
  2. object ApplyMap

    Permalink
  3. object AttachToEntity

    Permalink
  4. object BetaReduction extends Serializable

    Permalink
  5. object ConcatBehavior

    Permalink
  6. object Normalize extends StatelessTransformer

    Permalink
  7. object NormalizeAggregationIdent

    Permalink
  8. object NormalizeNestedStructures

    Permalink
  9. object NormalizeReturning

    Permalink
  10. object OrderTerms

    Permalink
  11. object RenameProperties extends StatelessTransformer

    Permalink
  12. object SimplifyNullChecks extends StatelessTransformer

    Permalink

    Due to the introduction of null checks in map, flatMap, and exists, in FlattenOptionOperation in order to resolve #1053, as well as to support non-ansi compliant string concatenation as outlined in #1295, large conditional composites became common.

    Due to the introduction of null checks in map, flatMap, and exists, in FlattenOptionOperation in order to resolve #1053, as well as to support non-ansi compliant string concatenation as outlined in #1295, large conditional composites became common. For example:

    case class Holder(value:Option[String])
    
    // The following statement
    query[Holder].map(h => h.value.map(_ + "foo"))
    // Will yield the following result
    SELECT CASE WHEN h.value IS NOT NULL THEN h.value || 'foo' ELSE null END FROM Holder h
    
    Now, let's add a getOrElse statement to the clause that requires an additional wrapped null check. We cannot rely on there being a map call beforehand since we could be reading value as a nullable field directly from the database).
    // The following statement
    query[Holder].map(h => h.value.map(_ + "foo").getOrElse("bar"))
    // Yields the following result:
    SELECT CASE WHEN
    CASE WHEN h.value IS NOT NULL THEN h.value || 'foo' ELSE null END
    IS NOT NULL THEN
    CASE WHEN h.value IS NOT NULL THEN h.value || 'foo' ELSE null END
    ELSE 'bar' END FROM Holder h
    
    This of course is highly redundant and can be reduced to simply:
    SELECT CASE WHEN h.value IS NOT NULL AND (h.value || 'foo') IS NOT NULL THEN h.value || 'foo' ELSE 'bar' END FROM Holder h
    
    This reduction is done by the "Center Rule." There are some other simplification rules as well. Note how we are force to null-check both h.value as well as (h.value || 'foo') because a user may use Option[T].flatMap and explicitly transform a particular value to null.

  13. object SymbolicReduction

    Permalink
  14. package capture

    Permalink

Ungrouped