Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
()
| 1338 | // Tx returns an `ent.Tx` for mutations that were executed in transactions; |
| 1339 | // it returns an error otherwise. |
| 1340 | func (m AttestationMutation) Tx() (*Tx, error) { |
| 1341 | if _, ok := m.driver.(*txDriver); !ok { |
| 1342 | return nil, errors.New("ent: mutation is not running in a transaction") |
| 1343 | } |
| 1344 | tx := &Tx{config: m.config} |
| 1345 | tx.init() |
| 1346 | return tx, nil |
| 1347 | } |
| 1348 | |
| 1349 | // SetID sets the value of the id field. Note that this |
| 1350 | // operation is only accepted on creation of Attestation entities. |