Package com.alibaba.cobar.client.router.rules.support

Examples of com.alibaba.cobar.client.router.rules.support.ModFunction


    public void testRuleShardingPatternWithCustomFunctions() throws Exception {
        String shardingExpression = "mod.apply(id)==3";
        IBatisNamespaceShardingRule r = new IBatisNamespaceShardingRule(DEFAULT_TYPE_PATTEN,
                StringUtils.join(DEFAULT_SHARDS, ","), shardingExpression);
        Map<String, Object> functions = new HashMap<String, Object>();
        functions.put("mod", new ModFunction(18L));
        r.setFunctionMap(functions);

        Tweet t = new Tweet();
        t.setId(3L);
        t.setTweet("anything");
View Full Code Here


    public void testSqlActionShardingRuleWithCustomFunctions() {
        IBatisSqlActionShardingRule r = new IBatisSqlActionShardingRule(DEFAULT_TYPE_PATTEN,
                "shard1,shard2", "mod.apply(id)==3");
        Map<String, Object> functions = new HashMap<String, Object>();
        functions.put("mod", new ModFunction(18L));
        r.setFunctionMap(functions);
       
        Tweet t = new Tweet();
        t.setId(21L);
        t.setTweet("anything");
View Full Code Here

TOP

Related Classes of com.alibaba.cobar.client.router.rules.support.ModFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.