Various improvements.
This commit is contained in:
27
README.md
27
README.md
@@ -75,6 +75,30 @@ func main() {
|
||||
- `serial.RandomCode(isInUse ...func(uint32) bool) (string, uint32, error)`
|
||||
- Generates a random valid `LLL-NNN-LC` code and its corresponding index.
|
||||
- If provided, the callback is used to skip indices already in use by the client.
|
||||
- `serial.RandomCodeWithOptions(options serial.RandomCodeOptions) (string, uint32, error)`
|
||||
- Configurable variant with `MaxAttempts`, `IsInUse`, and custom `RandomIndex` source.
|
||||
|
||||
Example with options:
|
||||
|
||||
```go
|
||||
// See the runnable command at ./cmd/triplex-example/main.go
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
Runnable example command:
|
||||
|
||||
```bash
|
||||
go run ./cmd/triplex-example
|
||||
```
|
||||
|
||||
Using Makefile:
|
||||
|
||||
```bash
|
||||
make run-example
|
||||
make build-example
|
||||
make test
|
||||
```
|
||||
|
||||
Exported errors:
|
||||
|
||||
@@ -85,7 +109,8 @@ Exported errors:
|
||||
- `serial.ErrNumberOutOfRange`
|
||||
- `serial.ErrInvalidChecksum`
|
||||
- `serial.ErrIndexOutOfRange`
|
||||
- `serial.ErrRandomGenerationFailed`
|
||||
- `serial.ErrRandomSourceFailed`
|
||||
- `serial.ErrNoAvailableIndex`
|
||||
|
||||
## Testing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user