Introduce New function (#47)

* feat(Sonyflake): define error variables

* feat(Sonyflake): add New() function
- minor logic improvements
- return errors

* tests(Sonyflake): remove old TestNilSonyflake test function in favour of the New() function coverage

* gofmt

* Update error messages and comments

* Introduce New function

---------

Co-authored-by: Quetzy Garcia <quetzy.garcia@integrate.com>
This commit is contained in:
Yoshiyuki MineoandQuetzy Garcia authored and GitHub committed 2023-08-14 01:27:55 +09:00
1 parent 18c4908321
commit 06f9b47996
3 files changed
+89 -36

No files matched your search

+2 -2
View File
@@ -33,10 +33,10 @@ go get github.com/sony/sonyflake
Usage
-----
The function NewSonyflake creates a new Sonyflake instance.
The function New creates a new Sonyflake instance.
```go
func NewSonyflake(st Settings) *Sonyflake
func New(st Settings) (*Sonyflake, error)
```
You can configure Sonyflake by the struct Settings: