Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
()
| 3227 | // Tx returns an `ent.Tx` for mutations that were executed in transactions; |
| 3228 | // it returns an error otherwise. |
| 3229 | func (m CASMappingMutation) Tx() (*Tx, error) { |
| 3230 | if _, ok := m.driver.(*txDriver); !ok { |
| 3231 | return nil, errors.New("ent: mutation is not running in a transaction") |
| 3232 | } |
| 3233 | tx := &Tx{config: m.config} |
| 3234 | tx.init() |
| 3235 | return tx, nil |
| 3236 | } |
| 3237 | |
| 3238 | // SetID sets the value of the id field. Note that this |
| 3239 | // operation is only accepted on creation of CASMapping entities. |