Skip to content

Instantly share code, notes, and snippets.

View hyouuu's full-sized avatar

hyouuu hyouuu

  • Lychee Isle
  • Los Angeles
View GitHub Profile
//
// CKSyncHandler+SyncHandlerDelegate.swift
// Pendo
//
// Created by Shawn Gong on 5/29/19.
// Copyright © 2019 Lychee Isle. All rights reserved.
//
import CloudKit
extension CKSyncHandler: SyncHandlerDelegate {
/*
Since CloudKit doesn't provide a way to query all recordIDs, we should keep that info in a Meta record so that we can efficiently maintain in sync.
A Meta record will have a String field "recordNames", which contains a list of record names like:
{title}___note_{UUID}___{update}___deleted
{title}___note_{UUID}___{update}
{title}___note_{UUID}__media_{mediaUUID}___{update}
{title}___note_{UUID}__media_{mediaUUID}_data___{update}
At init we fetch the Meta to compile the recordNames, then when we write or delete records, update the Meta and upload. We listen to changes to it and update our local copy.
@hyouuu
hyouuu / test.swift
Last active May 9, 2019 22:48
Test
func test() {
}
@hyouuu
hyouuu / gist:8e9e5dc1e3c397d1f72b6abf49b8f514
Created May 16, 2018 09:48
Thread 1: Fatal error: Error raised at top level: ⚠️ PostgreSQL Error: Could not parse Date from binary data type: UNKNOWN 1184. - id: PostgreSQLError.date
// Fluent 2 model - note that in fluent.json I have:
// "idType": "uuid",
// "keyNamingConvention": "camelCase"
import Foundation
import Vapor
import FluentProvider
import HTTP
final class User: Model {