member := &model.ChannelMember{ ChannelId: "channel_id", UserId: "user_id", Roles: "member", }
member, appErr := store.Channel().GetMember(channelId, userId) if appErr != nil { return nil, appErr } member.Roles = "member,channel_admin" if appErr := store.Channel().UpdateMember(member); appErr != nil { return nil, appErr } return member, nilIn the first example, we instantiate a new ChannelMember struct with a channel id, user id, and roles set to "member". In the second example, we first retrieve an existing channel member from the database using the channelId and userId, update the roles to "member,channel_admin", and then update the member in the database. Both examples utilize the Channel member methods provided by the Mattermost Platform Model library.