(actorType ActorType, actorID uuid.UUID, email, name string)
| 184 | } |
| 185 | |
| 186 | func WithActor(actorType ActorType, actorID uuid.UUID, email, name string) GeneratorOption { |
| 187 | return func(a *GeneratorOptions) error { |
| 188 | if actorType == "" { |
| 189 | return errors.New("actor type is required") |
| 190 | } |
| 191 | |
| 192 | if actorType == ActorTypeUser && email == "" { |
| 193 | return errors.New("email is required") |
| 194 | } |
| 195 | |
| 196 | a.ActorType = actorType |
| 197 | // Only set actorID if it is not the zero value |
| 198 | if actorID != uuid.Nil { |
| 199 | a.ActorID = &actorID |
| 200 | } |
| 201 | // Only set email if it is not empty |
| 202 | if email != "" { |
| 203 | a.ActorEmail = email |
| 204 | } |
| 205 | |
| 206 | if name != "" { |
| 207 | a.ActorName = name |
| 208 | } |
| 209 | |
| 210 | return nil |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | func WithOrgID(orgID uuid.UUID) GeneratorOption { |
| 215 | return func(a *GeneratorOptions) error { |
no outgoing calls