You are viewing Skygear v1 Documentation.Switch to Skygear v0 Documentation
Location, Auto-increment Sequence Fields
Location
- Supported by saving
CLLocation
inSKYRecord
- Only latitude and longitude of
CLLocation
is recorded
Saving a location on record
See Location and Maps Programming Guide for help on getting current location.
Querying records by distance
Get all photos taken within 400 meters of some location.
distanceToLocation:fromLocation:
is a Skygear function which returns distance
between a location field in a record and a specific location.
Sorting records by distance
Cont. from the example above.
Retrieving record location field distances relative to a point
Utilize transient fields.
Then we can access the distance in completionHandler
like this:
Auto-increment sequence fields
Make use of sequence object
Skygear reserves the id
field in the top level of all record as a primary key.
id
must be unique and default to be Version 4 UUID. If you want to
auto-incrementing id for display purpose, Skygear provide a sequence for this
purpose. The sequence is guaranteed unique.
- You can omit the
noteID
on update, the value will remain unchanged. - All the other
Note
in the database will now automatically have theirnoteID
as well. - You can migrate any integer to auto-incrementing sequence.
- Our JIT schema at development will migrate the DB schema to sequence. All
noteID
atNote
will be a sequence type once migrated.