# nanoid v1

### Repository

{% embed url="<https://github.com/metadiv-io/nanoid/tree/v1>" %}

### Installation

```bash
go get -u github.com/metadiv-io/nanoid
```

### Generate NanoID

```go
id, err := nanoid.New(21, 
    nanoid.AlphabetNumbers+nanoid.AlphabetLower+nanoid.AlphabetUpper)
```

### Generate NanoID with alike charaters (1lI0Oouv5Ss)

```go
id, err := nanoid.NewWithoutAlike(21, 
    nanoid.AlphabetNumbers+nanoid.AlphabetLower+nanoid.AlphabetUpper)
```

### Generate NanoID with defualt charaters and size

This method generate 21-length nanoid with numbers, lower cases and upper cases without alike charaters. Only 1% possibility on collision for generating 1000 nanoid per second in \~6 millions of year:\\

{% embed url="<https://alex7kom.github.io/nano-nanoid-cc/?alphabet=2346789abcdefghijkmnopqrtwxyzABCDEFGHJKLMNOPQRTUVWXYZ&size=21&speed=1000&speedUnit=second>" %}

```go
id := nanoid.NewSafe()
```
