@@ -292,8 +292,6 @@ func TestWorkflowEncoding(t *testing.T) {
292292 })
293293}
294294
295- // UserDefinedEventData is a custom struct declared outside of any workflow
296- // This struct should never appear in the signature of a function registered as a DBOS workflow
297295type UserDefinedEventData struct {
298296 ID int `json:"id"`
299297 Name string `json:"name"`
@@ -304,7 +302,6 @@ type UserDefinedEventData struct {
304302}
305303
306304func setEventUserDefinedTypeWorkflow (ctx context.Context , input string ) (string , error ) {
307- // Create an instance of our user-defined type inside the workflow
308305 eventData := UserDefinedEventData {
309306 ID : 42 ,
310307 Name : "test-event" ,
@@ -317,8 +314,6 @@ func setEventUserDefinedTypeWorkflow(ctx context.Context, input string) (string,
317314 },
318315 }
319316
320- // SetEvent should automatically register this type with gob
321- // Note the explicit type parameter since compiler cannot infer UserDefinedEventData from string input
322317 err := SetEvent (ctx , WorkflowSetEventInput [UserDefinedEventData ]{Key : input , Message : eventData })
323318 if err != nil {
324319 return "" , err
@@ -379,19 +374,10 @@ func TestSetEventSerialize(t *testing.T) {
379374 })
380375}
381376
382- // UserDefinedSendData is a custom struct for testing Send serialization
383- type UserDefinedSendData struct {
384- ID int `json:"id"`
385- Name string `json:"name"`
386- Details struct {
387- Description string `json:"description"`
388- Tags []string `json:"tags"`
389- } `json:"details"`
390- }
391377
392378func sendUserDefinedTypeWorkflow (ctx context.Context , destinationID string ) (string , error ) {
393379 // Create an instance of our user-defined type inside the workflow
394- sendData := UserDefinedSendData {
380+ sendData := UserDefinedEventData {
395381 ID : 42 ,
396382 Name : "test-send-message" ,
397383 Details : struct {
@@ -404,8 +390,8 @@ func sendUserDefinedTypeWorkflow(ctx context.Context, destinationID string) (str
404390 }
405391
406392 // Send should automatically register this type with gob
407- // Note the explicit type parameter since compiler cannot infer UserDefinedSendData from string input
408- err := Send (ctx , WorkflowSendInput [UserDefinedSendData ]{
393+ // Note the explicit type parameter since compiler cannot infer UserDefinedEventData from string input
394+ err := Send (ctx , WorkflowSendInput [UserDefinedEventData ]{
409395 DestinationID : destinationID ,
410396 Topic : "user-defined-topic" ,
411397 Message : sendData ,
@@ -416,9 +402,9 @@ func sendUserDefinedTypeWorkflow(ctx context.Context, destinationID string) (str
416402 return "user-defined-message-sent" , nil
417403}
418404
419- func recvUserDefinedTypeWorkflow (ctx context.Context , input string ) (UserDefinedSendData , error ) {
405+ func recvUserDefinedTypeWorkflow (ctx context.Context , input string ) (UserDefinedEventData , error ) {
420406 // Receive the user-defined type message
421- result , err := Recv [UserDefinedSendData ](ctx , WorkflowRecvInput {
407+ result , err := Recv [UserDefinedEventData ](ctx , WorkflowRecvInput {
422408 Topic : "user-defined-topic" ,
423409 Timeout : 3 * time .Second ,
424410 })
0 commit comments