prepareUpdateMutation is a helper that extracts the ID and merges the entity using the mapper. nolint:ireturn // ID is a type parameter, not a generic interface.
(row *spanner.Row, input ExternalStruct)
| 1611 | func prepareInsertMutation[ |
| 1612 | M writeableEntityMapperWithIDRetrieval[ExternalStruct, SpannerStruct, Key, ID], |
| 1613 | ExternalStruct any, |
| 1614 | SpannerStruct any, |
| 1615 | Key comparable, |
| 1616 | ID any](input ExternalStruct) (*spanner.Mutation, ID, error) { |
| 1617 | var mapper M |
| 1618 | spannerEntity, newID, err := mapper.NewEntityWithID(input) |
| 1619 | if err != nil { |
| 1620 | return nil, *new(ID), err |
| 1621 | } |
| 1622 | |
| 1623 | m, err := spanner.InsertStruct(mapper.Table(), spannerEntity) |
| 1624 | if err != nil { |
| 1625 | return nil, *new(ID), errors.Join(ErrInternalMutationFailure, err) |
| 1626 | } |
| 1627 | |
| 1628 | return m, newID, nil |
| 1629 | } |
| 1630 | |
| 1631 | // prepareUpdateMutation is a helper that extracts the ID and merges the entity using the mapper. |
| 1632 | // nolint:ireturn // ID is a type parameter, not a generic interface. |
| 1633 | func prepareUpdateMutation[ |
| 1634 | M writeableEntityMapperWithIDRetrieval[ExternalStruct, SpannerStruct, Key, ID], |
| 1635 | ExternalStruct any, |
| 1636 | SpannerStruct any, |
| 1637 | Key comparable, |
| 1638 | ID any](row *spanner.Row, input ExternalStruct) (*spanner.Mutation, ID, error) { |
| 1639 | var mapper M |
no test coverage detected