mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2024-12-15 11:00:41 +01:00
18 lines
333 B
Go
18 lines
333 B
Go
|
package lib
|
||
|
|
||
|
import "github.com/google/uuid"
|
||
|
|
||
|
// IdGenerator generates unique ids
|
||
|
type IdGenerator interface {
|
||
|
// GetId generates a unique ID or an error if something went wrong
|
||
|
GetId() (string, error)
|
||
|
}
|
||
|
|
||
|
type UUIDGenerator struct {
|
||
|
}
|
||
|
|
||
|
func (g *UUIDGenerator) GetId() (string, error) {
|
||
|
id := uuid.New()
|
||
|
return id.String(), nil
|
||
|
}
|