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

torand / FasterSQL / 13433984581

20 Feb 2025 11:12AM UTC coverage: 62.486% (+0.6%) from 61.863%
13433984581

push

github

torand
feat: add support for current_time and current_date functions

169 of 352 branches covered (48.01%)

Branch coverage included in aggregate %.

26 of 27 new or added lines in 9 files covered. (96.3%)

912 of 1378 relevant lines covered (66.18%)

3.47 hits per line

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

81.82
/src/main/java/io/github/torand/fastersql/function/system/CurrentTime.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.function.system;
17

18
import io.github.torand.fastersql.Context;
19
import io.github.torand.fastersql.projection.Projection;
20

21
import static io.github.torand.fastersql.dialect.Capability.CURRENT_TIME;
22
import static io.github.torand.fastersql.util.contract.Requires.requireNonBlank;
23

24
public class CurrentTime implements SystemFunction {
25
    private final String alias;
26

27
    CurrentTime(String alias) {
2✔
28
        this.alias = alias;
3✔
29
    }
1✔
30

31
    // Sql
32

33
    @Override
34
    public String sql(Context context) {
35
        if (!context.getDialect().supports(CURRENT_TIME)) {
5!
NEW
36
            throw new UnsupportedOperationException("%s does not support the current_time function".formatted(context.getDialect().getProductName()));
×
37
        }
38

39
        return "current_time";
2✔
40
    }
41

42
    // Projection
43

44
    @Override
45
    public Projection as(String alias) {
46
        requireNonBlank(alias, "No alias specified");
6✔
47
        return new CurrentTime(alias);
5✔
48
    }
49

50
    @Override
51
    public String alias() {
52
        return alias;
3✔
53
    }
54
}
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