MCPcopy
hub / github.com/tinode/chat / ApplyMutation

Method ApplyMutation

server/store/types/types.go:738–746  ·  view source on GitHub ↗

ApplyMutation sets of modifies access mode: * if `mutation` contains either '+' or '-', attempts to apply a delta change on `m`. * otherwise, treats it as an assignment.

(mutation string)

Source from the content-addressed store, hash-verified

736// * if `mutation` contains either '+' or '-', attempts to apply a delta change on `m`.
737// * otherwise, treats it as an assignment.
738func (m *AccessMode) ApplyMutation(mutation string) error {
739 if mutation == "" {
740 return nil
741 }
742 if strings.ContainsAny(mutation, "+-") {
743 return m.ApplyDelta(mutation)
744 }
745 return m.UnmarshalText([]byte(mutation))
746}
747
748// ApplyDelta applies the acs delta to AccessMode.
749// Delta is in the same format as generated by AccessMode.Delta.

Callers 1

updateAcsFromPresMsgMethod · 0.80

Calls 2

ApplyDeltaMethod · 0.95
UnmarshalTextMethod · 0.95

Tested by

no test coverage detected