feat: mail service
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// Package id provides internal identifier generators used by Mail Service.
|
||||
package id
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"galaxy/mail/internal/domain/common"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// Generator builds UUID-backed internal delivery identifiers.
|
||||
type Generator struct{}
|
||||
|
||||
// NewDeliveryID returns one new UUID v4 delivery identifier.
|
||||
func (Generator) NewDeliveryID() (common.DeliveryID, error) {
|
||||
value, err := uuid.NewRandom()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("new delivery id: %w", err)
|
||||
}
|
||||
|
||||
return common.DeliveryID(value.String()), nil
|
||||
}
|
||||
Reference in New Issue
Block a user