Browse Source

edit

tags/v1.0.0
zhouzj 4 years ago
parent
commit
bd610e6f50
1 changed files with 16 additions and 8 deletions
  1. +16
    -8
      README.md

+ 16
- 8
README.md View File

@@ -59,25 +59,33 @@

## 使用方法

#### 雪花漂移算法
```
var options = new IdGeneratorOptions()
{
Method = 1,
StartTime = DateTime.Now.AddYears(-1),
// 设置WorkerId,默认最大2^16-1
WorkerId = 1
};

//TopOverCostCount = 1000,
WorkerIdBitLength = 6,
SeqBitLength = 6,
var IdGen = new YitIdGenerator(options);
var newId = IdGen.NewLong();
```

//MinSeqNumber = 11,
//MaxSeqNumber = 200,
#### 传统雪花算法
```
var options = new IdGeneratorOptions()
{
Method = 2,
WorkerId = 1
};

var IdGen = new YitIdGenerator(options);
var newId = IdGen.NewLong();
```

## 参数说明
## options说明
options参数(Method、StartTime除外)只支持漂移算法,不支持传统雪花算法。

```
public class IdGeneratorOptions
{


Loading…
Cancel
Save