23 lines
396 B
Go
23 lines
396 B
Go
|
|
package client
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"queryorchestration/internal/database"
|
||
|
|
|
||
|
|
"github.com/google/uuid"
|
||
|
|
)
|
||
|
|
|
||
|
|
func (s *Service) Create(ctx context.Context, name string) (uuid.UUID, error) {
|
||
|
|
name, err := normalizeName(name)
|
||
|
|
if err != nil {
|
||
|
|
return uuid.Nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
id, err := s.db.Queries.CreateClient(ctx, name)
|
||
|
|
if err != nil {
|
||
|
|
return uuid.Nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
return database.MustToUUID(id), nil
|
||
|
|
}
|