1
0
mirror of https://github.com/mxpv/podsync.git synced 2024-05-11 05:55:04 +00:00
mxpv-podsync/pkg/feeds/id_gen.go
Maksym Pavlenko c378ed0a87 Code style fixes
2019-01-06 21:36:42 -08:00

25 lines
378 B
Go

package feeds
import (
"time"
shortid "github.com/ventu-io/go-shortid"
)
type IDGen struct {
sid *shortid.Shortid
}
func NewIDGen() (IDGen, error) {
sid, err := shortid.New(1, shortid.DefaultABC, uint64(time.Now().UnixNano()))
if err != nil {
return IDGen{}, err
}
return IDGen{sid}, nil
}
func (id IDGen) Generate() (string, error) {
return id.sid.Generate()
}