Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bindgen] Enable support for collections in the Mixed data type #7392

Merged
merged 14 commits into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 48 additions & 16 deletions bindgen/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,21 +168,19 @@ enums:
Collection: 896 # Array | Set | Dictionary
Flags: 960 # Nullable | Collection

CollectionType:
values:
List: 19
Set: 20
Dictionary: 21

TableType:
cppName: ObjectSchema::ObjectType
values:
TopLevel: 0
Embedded: 1
TopLevelAsymmetric: 0x2

ClientResetMode:
cppName: ClientResyncMode
values:
- Manual
- DiscardLocal
- Recover
- RecoverOrDiscard

DataType:
cppName: DataType::Type
values:
Expand All @@ -200,12 +198,6 @@ enums:
TypedLink: 16
UUID: 17

AppCacheMode:
cppName: app::App::CacheMode
values:
- Enabled
- Disabled

AuthProvider:
cppName: app::AuthProvider
values:
Expand All @@ -218,12 +210,28 @@ enums:
- USERNAME_PASSWORD
- FUNCTION
- API_KEY

AppCacheMode:
cppName: app::App::CacheMode
values:
- Enabled
- Disabled

ClientResetMode:
cppName: ClientResyncMode
values:
- Manual
- DiscardLocal
- Recover
- RecoverOrDiscard

MetadataMode:
cppName: SyncClientConfig::MetadataMode
values:
- NoEncryption
- Encryption
- NoMetadata

LoggerLevel:
cppName: util::Logger::Level
values:
Expand All @@ -236,6 +244,7 @@ enums:
- error
- fatal
- off

HttpMethod:
cppName: app::HttpMethod
values:
Expand All @@ -244,24 +253,28 @@ enums:
- patch
- put
- del

SyncSessionStopPolicy:
values:
- Immediately
- LiveIndefinitely
- AfterChangesUploaded

SyncSessionState:
cppName: SyncSession::State
values:
- Active
- Dying
- Inactive
- WaitingForAccessToken

SyncSessionConnectionState:
cppName: SyncSession::ConnectionState
values:
- Disconnected
- Connecting
- Connected

SyncErrorAction:
cppName: sync::ProtocolErrorInfo::Action
values:
Expand All @@ -273,17 +286,20 @@ enums:
- DeleteRealm
- ClientReset
- ClientResetNoRecovery

ProgressDirection:
cppName: SyncSession::ProgressDirection
values:
- upload
- download

SyncUserState:
cppName: SyncUser::State
values:
- LoggedOut
- LoggedIn
- Removed

SyncSubscriptionSetState:
cppName: sync::SubscriptionSet::State
values:
Expand All @@ -294,12 +310,14 @@ enums:
- Error
- Superseded
- AwaitingMark

WatchStreamState:
cppName: app::WatchStream::State
values:
- NEED_DATA
- HAVE_EVENT
- HAVE_ERROR

ProxyType:
cppName: SyncConfig::ProxyConfig::Type
values:
Expand Down Expand Up @@ -756,6 +774,7 @@ classes:
- '(column: ColKey, value: Mixed)'
- sig: '(column: ColKey, value: Mixed, is_default: bool)'
suffix: with_default
set_collection: '(column: ColKey, type: CollectionType) -> Obj'
get_linked_object: '(column: ColKey) const -> Nullable<Obj>'
to_string: () const -> std::string
get_backlink_count: '() const -> count_t'
Expand Down Expand Up @@ -854,6 +873,8 @@ classes:
suffix: 'obj'
get_any: '(index: count_t) -> Mixed'
get_dictionary_element: '(index: count_t) -> std::pair<StringData, Mixed>'
get_list: '(index: count_t) -> List'
get_dictionary: '(index: count_t) -> Dictionary'
filter: '(query: Query&&) const -> Results'
sort:
- '(order: SortDescriptor&&) const -> Results'
Expand Down Expand Up @@ -1009,7 +1030,11 @@ classes:
constructors:
make: '(r: SharedRealm, parent: const Obj&, col: ColKey)'
methods:
get: '(ndx: count_t) const -> Obj'
get:
- sig: '(ndx: count_t) -> Obj'
suffix: 'obj'
get_list: '(path_elem: int) -> List'
get_dictionary: '(path_elem: int) -> Dictionary'
move: '(source_ndx: count_t, dest_ndx: count_t)'
remove: '(ndx: count_t)'
remove_all: '()'
Expand All @@ -1018,8 +1043,10 @@ classes:
delete_all: '()'
insert_any: '(list_ndx: count_t, value: Mixed)'
insert_embedded: '(ndx: count_t) -> Obj'
insert_collection: '(path_elem: int, dict_or_list: CollectionType)'
set_any: '(list_ndx: count_t, value: Mixed)'
set_embedded: '(list_ndx: count_t) -> Obj'
set_collection: '(path_element: int, dict_or_list: CollectionType)'
filter: '(q: Query) const -> Results'
freeze: '(frozen_realm: SharedRealm const&) const -> List'

Expand All @@ -1046,7 +1073,9 @@ classes:
constructors:
make: '(r: SharedRealm, parent: const Obj&, col: ColKey)'
methods:
get: '(ndx: count_t) const -> Obj'
get:
- sig: '(ndx: count_t) -> Obj'
suffix: 'obj'
insert_any: '(val: Mixed) -> std::pair<count_t, bool>'
remove_any: '(val: Mixed) -> std::pair<count_t, bool>'
remove_all: '()'
Expand Down Expand Up @@ -1096,11 +1125,14 @@ classes:
- sig: '(key: StringData) const -> Obj'
cppName: get<Obj> # TODO can't distinguish null from missing
get_pair: '(ndx: count_t) const -> std::pair<StringData, Mixed>'
get_list: '(path_elem: std::string) -> List'
get_dictionary: '(path_elem: std::string) -> Dictionary'
contains: '(key: StringData) -> bool'
freeze: '(frozen_realm: SharedRealm const&) const -> Dictionary'
add_key_based_notification_callback: '(cb: (changes: DictionaryChangeSet), keyPaths: std::optional<KeyPathArray>) -> NotificationToken'
insert_any: '(key: StringData, value: Mixed) -> std::pair<count_t, bool>'
insert_embedded: '(key: StringData) -> Obj'
insert_collection: '(path_elem: std::string, dict_or_list: CollectionType)'
try_get_any: '(key: StringData) const -> std::optional<Mixed>'
remove_all: '()'
try_erase: '(key: StringData) -> bool'
Expand Down
Loading