Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
()
| 1849 | // Tx returns an `ent.Tx` for mutations that were executed in transactions; |
| 1850 | // it returns an error otherwise. |
| 1851 | func (m CASBackendMutation) Tx() (*Tx, error) { |
| 1852 | if _, ok := m.driver.(*txDriver); !ok { |
| 1853 | return nil, errors.New("ent: mutation is not running in a transaction") |
| 1854 | } |
| 1855 | tx := &Tx{config: m.config} |
| 1856 | tx.init() |
| 1857 | return tx, nil |
| 1858 | } |
| 1859 | |
| 1860 | // SetID sets the value of the id field. Note that this |
| 1861 | // operation is only accepted on creation of CASBackend entities. |