com.aerospike.jdbc.predicate.QueryPredicateLike Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aerospike-jdbc Show documentation
Show all versions of aerospike-jdbc Show documentation
A JDBC driver for the Aerospike database
The newest version!
package com.aerospike.jdbc.predicate;
import com.aerospike.client.exp.Exp;
import com.aerospike.client.query.Filter;
import com.aerospike.client.query.RegexFlag;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
public class QueryPredicateLike extends QueryPredicateBase {
private final String expression;
public QueryPredicateLike(String binName, String expression) {
super(binName, Exp.Type.STRING);
this.expression = expression.replace("%", ".*");
}
@Override
public Exp toFilterExpression(boolean withPrimaryKey) {
return Exp.regexCompare(
expression,
RegexFlag.ICASE | RegexFlag.NEWLINE,
buildLeftExp()
);
}
@Override
public Optional toFilter(String binName) {
return Optional.empty();
}
@Override
public boolean isIndexable() {
return false;
}
@Override
public List getBinNames() {
return Collections.emptyList();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy