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

Add UUID support #2120

Merged
merged 20 commits into from
Dec 4, 2020
Merged

Add UUID support #2120

merged 20 commits into from
Dec 4, 2020

Conversation

papafe
Copy link
Contributor

@papafe papafe commented Nov 13, 2020

Description

Add support for UUID data type.
In order to use this, the object property must be declared of type Guid:

public MyObject : RealmObject
{
    public Guid Id {get; set;}

    .... 
}

The new data type:

  • Can be used as a primary key
  • Can be used in queries: equal, not equal
  • Is indexable

Fixes #2065

TODO

  • Changelog entry
  • Tests (if applicable)

Copy link
Member

@nirinchev nirinchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty good! Need a changelog entry + a few nits, but otherwise seems to be ready to merge!

Realm/Realm/Native/PrimitiveValue.cs Outdated Show resolved Hide resolved
Tests/Realm.Tests/Database/TestObjects.cs Show resolved Hide resolved
Tests/Weaver/AssemblyToProcess/TestObjects.cs Outdated Show resolved Hide resolved
Tests/Weaver/AssemblyToProcess/TestObjects.cs Outdated Show resolved Hide resolved
wrappers/src/marshalling.hpp Outdated Show resolved Hide resolved
@nirinchev
Copy link
Member

Oh, just noticed - can we add a test for [Indexed] applied on a Guid property?

@bmunkholm
Copy link
Contributor

This should likely not be a "draft" anymore if it's ready for review and merging :-)?

@papafe papafe marked this pull request as ready for review November 13, 2020 13:40
@papafe
Copy link
Contributor Author

papafe commented Nov 13, 2020

Added corrections for Weaver tests, added data type to the list of indexable ones and added it to the tests.

@papafe
Copy link
Contributor Author

papafe commented Nov 13, 2020

Slightly modified the copy mechanism according to comment

@papafe
Copy link
Contributor Author

papafe commented Nov 16, 2020

Added support and tests for list of Guids

Base automatically changed from ni/mixed to master December 2, 2020 01:39
Copy link
Member

@nirinchev nirinchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@papafe I feel bad for the ton of conflicts, so I'll get this rebased and merged tomorrow.

CHANGELOG.md Outdated
@@ -59,7 +59,8 @@
* Added `User.GetPushClient` exposing an API for registering a device for push notifications.
* Change `SyncConfiguration` to accept partition value instead of a server Uri. Partition values can currently be of types `string`, `long`, or `ObjectId`. Opening a realm by partition value is the equivalent of previously opening a realm by URL. In this case, partitions are meant to be more closely associated with your data. E.g., if you are a large retailer with multiple locations, the partition key can be the store Id and you each Realm will only contain data related to the specified store.
* Add support for the Decimal128 data type. This is a 128-bit IEEE 754 decimal floating point number. Properties of this type can be declared either as `MongoDB.Bson.Decimal128` type or the built-in `decimal` type. Note that .NET's built-in decimal is 96-bit, so it cannot represent the full range of numbers, representable by `Decimal128`. (PR [#2014](https://github.com/realm/realm-dotnet/pull/2014))
* Add support for the `ObjectId` data type. This is a 12 byte unique identifier that is common as a document id in MongoDB databases. It can be used a primary key. (PR [#2035](https://github.com/realm/realm-dotnet/pull/2035))
* Add support for the `ObjectId` data type. This is a 12 byte unique identifier that is common as a document id in MongoDB databases. It can be used as primary key. (PR [#2035](https://github.com/realm/realm-dotnet/pull/2035))
* Add support for the `GUID` data type. It can be used as primary key and is indexable. (PR [#2120](https://github.com/realm/realm-dotnet/pull/2120))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the wrong release for this - it should probably go in the vNext section.

@nirinchev nirinchev merged commit 7ef90bc into master Dec 4, 2020
@nirinchev nirinchev deleted the fp/uuid-2065 branch December 4, 2020 11:16
@nirinchev nirinchev mentioned this pull request Jan 15, 2021
2 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement UUID data type
5 participants