withCASBackendID sets the ID field of the mutation.
(id uuid.UUID)
| 1808 | |
| 1809 | // withCASBackendID sets the ID field of the mutation. |
| 1810 | func withCASBackendID(id uuid.UUID) casbackendOption { |
| 1811 | return func(m *CASBackendMutation) { |
| 1812 | var ( |
| 1813 | err error |
| 1814 | once sync.Once |
| 1815 | value *CASBackend |
| 1816 | ) |
| 1817 | m.oldValue = func(ctx context.Context) (*CASBackend, error) { |
| 1818 | once.Do(func() { |
| 1819 | if m.done { |
| 1820 | err = errors.New("querying old values post mutation is not allowed") |
| 1821 | } else { |
| 1822 | value, err = m.Client().CASBackend.Get(ctx, id) |
| 1823 | } |
| 1824 | }) |
| 1825 | return value, err |
| 1826 | } |
| 1827 | m.id = &id |
| 1828 | } |
| 1829 | } |
| 1830 | |
| 1831 | // withCASBackend sets the old CASBackend of the mutation. |
| 1832 | func withCASBackend(node *CASBackend) casbackendOption { |
no test coverage detected