88
ctx context.Context,
89
row *sqlplugin.VisibilityRow,
91
>
finalRow := mdb.prepareRowForDB(row)
92
>
defer func() {
93
>
retError = mdb.handle.ConvertError(retError)
94
>
}()
95
>
db, err := mdb.handle.DB()
96
>
if err != nil {
97
return nil, err
98
}
99
101
>
if err != nil {
102
return nil, err
103
}
105
>
err := tx.Rollback()
106
>
// If the error is sql.ErrTxDone, it means the transaction already closed, so ignore error.
107
>
if err != nil && !errors.Is(err, sql.ErrTxDone) {
108
// Transaction rollback error should never happen, unless db connection was lost.
109
retError = fmt.Errorf("transaction rollback failed: %w", retError)
110
}
111
}()
112
>
result, err = tx.NamedExecContext(ctx, templateInsertWorkflowExecution, finalRow)
visibility.go
113
>
if err != nil {
114
return nil, fmt.Errorf("unable to insert workflow execution: %w", err)
115
}
116
>
_, err = tx.NamedExecContext(ctx, templateInsertCustomSearchAttributes, finalRow)
visibility.go
117
>
if err != nil {
118
return nil, fmt.Errorf("unable to insert custom search attributes: %w", err)
119
}
120
>
_, err = tx.NamedExecContext(ctx, templateInsertChasmSearchAttributes, finalRow)
visibility.go
121
>
if err != nil {
122
return nil, fmt.Errorf("unable to insert chasm search attributes: %w", err)
123
}
125
>
if err != nil {
126
return nil, err
127
}
129
}
130