Beispiel #1
0
        internal override void WriteExpressionStatement(ref NoAllocStringBuilder builder, ref int valuesCount, DdbExpressionVisitor visitor)
        {
            // "REMOVE #a"

            visitor.Visit <TEntity>(Expression);
            builder.Append(visitor.Builder);
        }
        internal override void WriteExpressionStatement(ref NoAllocStringBuilder builder, ref int valuesCount, DdbExpressionVisitor visitor)
        {
            // "#a = :v0"

            visitor.Visit <TEntity>(Expression);

            WriteEncodedExpressionName(visitor.Builder, _useSize, ref builder);
            builder.Append(" = :v");
            builder.Append(valuesCount++);
        }
Beispiel #3
0
        internal override void WriteExpressionStatement(ref NoAllocStringBuilder builder, ref int valuesCount, DdbExpressionVisitor visitor)
        {
            // attribute_not_exists(#a)

            visitor.Visit <TEntity>(Expression);

            builder.Append("attribute_not_exists(");
            builder.Append(visitor.Builder);
            builder.Append(')');
        }
Beispiel #4
0
        internal override void WriteExpressionStatement(ref NoAllocStringBuilder builder, ref int valuesCount, DdbExpressionVisitor visitor)
        {
            // "SET #a = if_not_exists(#b, :v0) + if_not_exists(#c, :v1)"

            visitor.Visit <TEntity>(Expression);
            builder.Append(visitor.Builder);

            builder.Append(" = ");

            WriteIfNotExistsBlock <TEntity>(ref builder, visitor, _left, ref valuesCount);

            AppendMathOperatorExpression(ref builder);

            WriteIfNotExistsBlock <TEntity>(ref builder, visitor, _right, ref valuesCount);
        }
        protected void AppendMathOperatorExpression(ref NoAllocStringBuilder builder)
        {
            switch (_mathOperator)
            {
            case AssignMathOperator.Plus:
                builder.Append(" + ");
                break;

            case AssignMathOperator.Minus:
                builder.Append(" - ");
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(_mathOperator), "Specified math operator is not supported");
            }
        }
Beispiel #6
0
        internal override void WriteExpressionStatement(ref NoAllocStringBuilder builder, ref int valuesCount, DdbExpressionVisitor visitor)
        {
            // "SET #a = #b + #c"

            visitor.Visit <TEntity>(Expression);
            builder.Append(visitor.Builder);

            builder.Append(" = ");

            visitor.Visit <TEntity>(_left);
            builder.Append(visitor.Builder);

            AppendMathOperatorExpression(ref builder);

            visitor.Visit <TEntity>(_right);
            builder.Append(visitor.Builder);
        }
Beispiel #7
0
        internal override void WriteExpressionStatement(ref NoAllocStringBuilder builder, ref int valuesCount, DdbExpressionVisitor visitor)
        {
            // "SET #a = list_append(:v0, if_not_exists(#b, :v1))"

            visitor.Visit <TEntity>(Expression);
            builder.Append(visitor.Builder);

            builder.Append(" = list_append(");

            builder.Append(":v");
            builder.Append(valuesCount++);

            builder.Append(',');

            WriteIfNotExistsBlock <TEntity>(ref builder, visitor, _right, ref valuesCount);

            builder.Append(')');
        }
        internal override void WriteExpressionStatement(ref NoAllocStringBuilder builder, ref int valuesCount, DdbExpressionVisitor visitor)
        {
            // "SET #a = list_append(#b,#c)"

            visitor.Visit <TEntity>(Expression);
            builder.Append(visitor.Builder);

            builder.Append(" = list_append(");

            visitor.Visit <TEntity>(_left);
            builder.Append(visitor.Builder);

            builder.Append(',');

            visitor.Visit <TEntity>(_right);
            builder.Append(visitor.Builder);

            builder.Append(')');
        }
Beispiel #9
0
        internal override void WriteExpressionStatement(ref NoAllocStringBuilder builder, ref int valuesCount, DdbExpressionVisitor visitor)
        {
            // "#a IN (:v0, :v1, :v2)"

            visitor.Visit <TEntity>(Expression);

            WriteEncodedExpressionName(visitor.Builder, _useSize, ref builder);
            builder.Append(" IN (");

            for (var i = 0; i < _values.Length; i++)
            {
                if (i > 0)
                {
                    builder.Append(", ");
                }

                builder.Append(":v");
                builder.Append(valuesCount++);
            }

            builder.Append(')');
        }
Beispiel #10
0
 /// <returns>
 /// The first value is the string to sign, the second value is the credentials scope.
 /// </returns>
 public static void Build(ref NoAllocStringBuilder builder, in SigningMetadata metadata)
Beispiel #11
0
 protected void WriteEncodedExpressionName(StringBuilder encodedExpressionName, bool useSize, ref NoAllocStringBuilder builder)
 {
     if (useSize)
     {
         builder.Append("size(");
         builder.Append(encodedExpressionName);
         builder.Append(')');
     }
     else
     {
         builder.Append(encodedExpressionName);
     }
 }
Beispiel #12
0
 internal abstract void WriteExpressionStatement(ref NoAllocStringBuilder builder, ref int valuesCount, DdbExpressionVisitor visitor);
Beispiel #13
0
 public static string Build(ref NoAllocStringBuilder builder, ref NoAllocStringBuilder signedHeadersBuilder, in SigningMetadata metadata)