Unverified Commit 330b216e authored by 张亮's avatar 张亮 Committed by GitHub
Browse files

Merge pull request #145 from tristaZero/dev

Add worker.id setting item
parents d96f57bd bb65624e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -44,7 +44,9 @@ public class ShardingDatabasesConfiguration implements ExampleConfiguration {

    private TableRuleConfiguration getSportsmanTableRuleConfiguration() {
        TableRuleConfiguration result = new TableRuleConfiguration("t_sportsman");
        result.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "id", new Properties()));
        Properties properties = new Properties();
        properties.setProperty("worker.id", "123");
        result.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "id", properties));
        return result;
    }

+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@ shardingRule:
      keyGenerator:
        type: SNOWFLAKE
        column: id
        props:
          worker.id: 123
  defaultDatabaseStrategy:
    inline:
      shardingColumn: id
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ shardingRule:
      keyGenerator:
        type: SNOWFLAKE
        column: order_id
        props:
          worker.id: 123
    t_order_item:
      actualDataNodes: ds_${0..1}.t_order_item_${0..1}
  bindingTables:
+3 −1
Original line number Diff line number Diff line
@@ -73,6 +73,8 @@ public final class LocalShardingDatabasesAndTablesConfiguration implements Examp
    }
    
    private static KeyGeneratorConfiguration getKeyGeneratorConfiguration() {
        return new KeyGeneratorConfiguration("SNOWFLAKE", "order_id", new Properties());
        Properties properties = new Properties();
        properties.setProperty("worker.id", "123");
        return new KeyGeneratorConfiguration("SNOWFLAKE", "order_id", properties);
    }
}
+3 −1
Original line number Diff line number Diff line
@@ -69,6 +69,8 @@ public final class LocalShardingDatabasesConfiguration implements ExampleConfigu
    }
    
    private static KeyGeneratorConfiguration getKeyGeneratorConfiguration() {
        return new KeyGeneratorConfiguration("SNOWFLAKE", "order_id", new Properties());
        Properties properties = new Properties();
        properties.setProperty("worker.id", "123");
        return new KeyGeneratorConfiguration("SNOWFLAKE", "order_id", properties);
    }
}
Loading