• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

realm / realm-core / 2386

04 Jun 2024 11:40PM UTC coverage: 90.844% (-0.003%) from 90.847%
2386

push

Evergreen

web-flow
Merge pull request #7734 from realm/tg/create-object-repl

RCORE-2152 Don't emit transaction log instructions for mutations on newly-created objects

101840 of 180236 branches covered (56.5%)

358 of 362 new or added lines in 6 files covered. (98.9%)

98 existing lines in 19 files now uncovered.

214786 of 236434 relevant lines covered (90.84%)

5684022.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.92
/src/realm/link_translator.cpp
1
/*************************************************************************
2
 *
3
 * Copyright 2022 Realm Inc.
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 *
17
 **************************************************************************/
18

19
#include "realm/link_translator.hpp"
20

21
#include <realm/dictionary.hpp>
22
#include <realm/list.hpp>
23
#include <realm/set.hpp>
24

25
namespace realm {
26

27
LinkTranslator::LinkTranslator(Obj origin, ColKey origin_col_key)
28
    : m_origin_obj(origin)
50,838✔
29
    , m_origin_col_key(origin_col_key)
50,838✔
30
{
101,679✔
31
}
101,679✔
32

33
void LinkTranslator::run()
34
{
101,679✔
35
    ColumnAttrMask attr = m_origin_col_key.get_attrs();
101,679✔
36
    if (attr.test(col_attr_List)) {
101,679✔
37
        if (m_origin_col_key.get_type() == col_type_Link) {
30,510✔
38
            LnkLst link_list = m_origin_obj.get_linklist(m_origin_col_key);
29,922✔
39
            on_list_of_links(link_list);
29,922✔
40
        }
29,922✔
41
        else if (m_origin_col_key.get_type() == col_type_Mixed) {
588✔
42
            Lst<Mixed> list = m_origin_obj.get_list<Mixed>(m_origin_col_key);
588✔
43
            on_list_of_mixed(list);
588✔
44
        }
588✔
45
        else {
×
46
            throw std::runtime_error(
×
47
                util::format("LinkTranslator unhandled list type: %1", m_origin_col_key.get_type()));
×
48
        }
×
49
    }
30,510✔
50
    else if (attr.test(col_attr_Set)) {
71,169✔
51
        if (m_origin_col_key.get_type() == col_type_Link) {
2,850✔
52
            LnkSet set = m_origin_obj.get_linkset(m_origin_col_key);
2,400✔
53
            on_set_of_links(set);
2,400✔
54
        }
2,400✔
55
        else if (m_origin_col_key.get_type() == col_type_Mixed) {
450✔
56
            Set<Mixed> set = m_origin_obj.get_set<Mixed>(m_origin_col_key);
450✔
57
            on_set_of_mixed(set);
450✔
58
        }
450✔
59
        else {
×
60
            throw std::runtime_error(
×
61
                util::format("LinkTranslator unhandled set type: %1", m_origin_col_key.get_type()));
×
62
        }
×
63
    }
2,850✔
64
    else if (attr.test(col_attr_Dictionary)) {
68,319✔
65
        auto dict = m_origin_obj.get_dictionary(m_origin_col_key);
1,038✔
66
        on_dictionary(dict);
1,038✔
67
    }
1,038✔
68
    else {
67,281✔
69
        REALM_ASSERT_EX(!m_origin_col_key.is_collection(), m_origin_col_key);
67,281✔
70
        if (m_origin_col_key.get_type() == col_type_Link) {
67,281✔
71
            on_link_property(m_origin_col_key);
67,185✔
72
        }
67,185✔
73
        else if (m_origin_col_key.get_type() == col_type_Mixed) {
96✔
74
            on_mixed_property(m_origin_col_key);
96✔
75
        }
96✔
UNCOV
76
        else {
×
UNCOV
77
            throw std::runtime_error(
×
UNCOV
78
                util::format("LinkTranslator unhandled property type: %1", m_origin_col_key.get_type()));
×
UNCOV
79
        }
×
80
    }
67,281✔
81
}
101,679✔
82

83
} // namespace realm
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc