Skip to content

Release 8.2

Latest
Compare
Choose a tag to compare
@fluentfuture fluentfuture released this 10 Nov 22:18
· 11 commits to master since this release

Mug Core

  • Substring.RepeatingPattern supports matching from the middle of a string:
    word().repeatedly().match(input, fromIndex)

Mug Guava

  • SafeSql - an injection-safe dynamic SQL template for JDBC. User-friendly API supporting powerful yet intuitive dynamic SQL composition and parameterization:
    SafeSql usersByName(String who, @CompileTimeConstant List<String> columns) {
      return SafeSql.of("SELECT `{columns}` FROM Users WHERE name LIKE '%{who}%'", columns, who);
    }
    
    try (var connection = DriverManager.getConnection(...)) {
      // SELECT `id`, `name` FROM Users WHERE name LIKE '%Emma%'
      List<User> users = usersByName("Emma", asList("id", "name"))
          .query(connection, row -> new User(row.getLong("id"), row.getString("name")));
      ...
    }