You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package com.fr.plugin.db.redis.core.visit;
|
|
|
|
|
|
|
|
import com.fanruan.api.util.StringKit;
|
|
|
|
import com.fr.plugin.db.redis.core.DataWrapper;
|
|
|
|
import com.fr.plugin.db.redis.core.RedisConstants;
|
|
|
|
import com.fr.stable.ParameterProvider;
|
|
|
|
import com.fr.stable.script.CalculatorProvider;
|
|
|
|
import redis.clients.jedis.Jedis;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by richie on 2017/5/2.
|
|
|
|
*/
|
|
|
|
public abstract class AbstractVisitor<T> implements Visitor<T> {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public DataWrapper<T> buildData(CalculatorProvider calculator, ParameterProvider[] ps, Jedis client, String query, int rowCount) throws Exception {
|
|
|
|
return DataWrapper.create(getContent(calculator, ps, client, query, rowCount), RedisConstants.DEFAULT_COLUMN_NAMES);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean match(String query) {
|
|
|
|
return query.trim().toLowerCase().startsWith(keyWord());
|
|
|
|
}
|
|
|
|
|
|
|
|
protected String trimCommand(String cmd) {
|
|
|
|
return StringKit.trim(cmd);
|
|
|
|
}
|
|
|
|
}
|