Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
()
| 10950 | // Tx returns an `ent.Tx` for mutations that were executed in transactions; |
| 10951 | // it returns an error otherwise. |
| 10952 | func (m ProjectMutation) Tx() (*Tx, error) { |
| 10953 | if _, ok := m.driver.(*txDriver); !ok { |
| 10954 | return nil, errors.New("ent: mutation is not running in a transaction") |
| 10955 | } |
| 10956 | tx := &Tx{config: m.config} |
| 10957 | tx.init() |
| 10958 | return tx, nil |
| 10959 | } |
| 10960 | |
| 10961 | // SetID sets the value of the id field. Note that this |
| 10962 | // operation is only accepted on creation of Project entities. |