• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

torand / FasterSQL / 12970315111

26 Jan 2025 01:44AM UTC coverage: 47.557% (-1.9%) from 49.458%
12970315111

push

github

torand
feat: add subquery support for more operators

108 of 322 branches covered (33.54%)

Branch coverage included in aggregate %.

0 of 59 new or added lines in 7 files covered. (0.0%)

622 of 1213 relevant lines covered (51.28%)

2.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/io/github/torand/fastersql/predicate/InSubquery.java
1
/*
2
 * Copyright (c) 2024 Tore Eide Andersen
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package io.github.torand.fastersql.predicate;
17

18
import io.github.torand.fastersql.Context;
19
import io.github.torand.fastersql.Field;
20
import io.github.torand.fastersql.subquery.Subquery;
21

22
import java.util.stream.Stream;
23

24
import static io.github.torand.fastersql.Clause.RESTRICTION;
25
import static java.util.Objects.requireNonNull;
26

27
public class InSubquery implements Predicate {
28
    private final LeftOperand left;
29
    private final Subquery right;
30

NEW
31
    InSubquery(LeftOperand left, Subquery right) {
×
NEW
32
        this.left = requireNonNull(left, "No left operand specified");
×
NEW
33
        this.right = requireNonNull(right, "No right operand specified");
×
NEW
34
    }
×
35

36
    // Sql
37

38
    @Override
39
    public String sql(Context context) {
NEW
40
        Context localContext = context.withClause(RESTRICTION);
×
NEW
41
        return left.sql(localContext) + " in " + right.sql(context);
×
42
    }
43

44
    @Override
45
    public Stream<Object> params(Context context) {
NEW
46
        return right.params(context);
×
47
    }
48

49
    // Predicate
50

51
    @Override
52
    public String negatedSql(Context context) {
NEW
53
        Context localContext = context.withClause(RESTRICTION);
×
NEW
54
        return left.sql(localContext) + " not in " + right.sql(context);
×
55
    }
56

57
    @Override
58
    public Stream<Field> fieldRefs() {
NEW
59
        return left.fieldRefs();
×
60
    }
61
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc