Skip to content

Commit

Permalink
feat(doc): Update getting-started.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahoo-Wang committed Aug 15, 2024
1 parent 133f21d commit 57598e2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions documentation/docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ cosid:
DefaultIdGeneratorProvider.INSTANCE.getShare();
```

> 通过`yml`文件配置`provider`创建多个`生成器`
### 注册多个 ID 生成器

> 通过配置文件的 `provider` 注册多个 ID 生成器

```yaml
spring:
Expand All @@ -109,21 +111,21 @@ cosid:
distributor:
type: redis
provider:
order:
order: # 命名为 order 的 ID 生成器
offset: 10000
item:
item: # 命名为 item 的 ID 生成器
offset: 10000
```

>通过`代码`创建多个多个`生成器`
> 通过编码注册多个 ID 生成器

```java
@Resource
IdGeneratorProvider provider;
@Resource
IdSegmentDistributorFactory idSegmentDistributorFactory;
public void createIdGenerator(String idName) {
public void registerIdGenerator(String idName) {
IdSegmentDistributorDefinition definition = new IdSegmentDistributorDefinition("namespace", "idName",0,100);
IdSegmentDistributor idSegmentDistributor = idSegmentDistributorFactory.create(definition);
SegmentChainId segmentId = new SegmentChainId(idSegmentDistributor);
Expand Down

0 comments on commit 57598e2

Please sign in to comment.