withMembershipID sets the ID field of the mutation.
(id uuid.UUID)
| 7054 | |
| 7055 | // withMembershipID sets the ID field of the mutation. |
| 7056 | func withMembershipID(id uuid.UUID) membershipOption { |
| 7057 | return func(m *MembershipMutation) { |
| 7058 | var ( |
| 7059 | err error |
| 7060 | once sync.Once |
| 7061 | value *Membership |
| 7062 | ) |
| 7063 | m.oldValue = func(ctx context.Context) (*Membership, error) { |
| 7064 | once.Do(func() { |
| 7065 | if m.done { |
| 7066 | err = errors.New("querying old values post mutation is not allowed") |
| 7067 | } else { |
| 7068 | value, err = m.Client().Membership.Get(ctx, id) |
| 7069 | } |
| 7070 | }) |
| 7071 | return value, err |
| 7072 | } |
| 7073 | m.id = &id |
| 7074 | } |
| 7075 | } |
| 7076 | |
| 7077 | // withMembership sets the old Membership of the mutation. |
| 7078 | func withMembership(node *Membership) membershipOption { |
no test coverage detected