Exemplo n.º 1
0
func (s SqlCommandStore) Update(cmd *model.Command) StoreChannel {
	storeChannel := make(StoreChannel)

	go func() {
		result := StoreResult{}

		cmd.UpdateAt = model.GetMillis()

		if _, err := s.GetMaster().Update(cmd); err != nil {
			result.Err = model.NewLocAppError("SqlCommandStore.Update", "store.sql_command.save.update.app_error", nil, "id="+cmd.Id+", "+err.Error())
		} else {
			result.Data = cmd
		}

		storeChannel <- result
		close(storeChannel)
	}()

	return storeChannel
}