{"id":13696007,"url":"https://github.com/ElfSundae/SQLitePersistentObjects","last_synced_at":"2025-05-03T14:30:45.925Z","repository":{"id":8344584,"uuid":"9903521","full_name":"ElfSundae/SQLitePersistentObjects","owner":"ElfSundae","description":"SQLite Persistent Objects for iOS.","archived":false,"fork":false,"pushed_at":"2016-01-25T08:57:10.000Z","size":1913,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-25T01:04:09.549Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ElfSundae.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-07T04:02:11.000Z","updated_at":"2021-08-21T08:09:22.000Z","dependencies_parsed_at":"2022-08-07T03:00:34.699Z","dependency_job_id":null,"html_url":"https://github.com/ElfSundae/SQLitePersistentObjects","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElfSundae%2FSQLitePersistentObjects","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElfSundae%2FSQLitePersistentObjects/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElfSundae%2FSQLitePersistentObjects/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElfSundae%2FSQLitePersistentObjects/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ElfSundae","download_url":"https://codeload.github.com/ElfSundae/SQLitePersistentObjects/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252203143,"owners_count":21710897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T18:00:35.499Z","updated_at":"2025-05-03T14:30:45.388Z","avatar_url":"https://github.com/ElfSundae.png","language":"Objective-C","funding_links":[],"categories":["Database, ORM, Cache"],"sub_categories":[],"readme":"Introduction\n======================\n\nPersistent Objects for Cocoa \u0026 Cocoa Touch that using SQLite.\n\nThis project based on http://code.google.com/p/sqlitepersistentobjects and https://bitbucket.org/gabrielayuso/sqlitepersistentobjects (make it thread safely)\n\nSetup\n=====================\n\n1. Add `SQLitePersistentObjects.framework` to your Xcode project\n2. Link the `libsqlite3.dylib`\n3. Add `-ObjC` to your project's settings `Other Linker Flags`\n4. `#import \u003cSQLitePersistentObjects/SQLitePersistentObjects.h\u003e` and subclass `SQLitePersistentObject` for your data model\n\n\nUsage\n======================\n**Overview:** http://code.google.com/p/sqlitepersistentobjects/source/browse/trunk/ReadMe.txt\n\n1. Declare your data objects inherited from `SQLitePersistentObject`. Every property that's not a collection class (NSDictionary, NSArray, NSSet or mutable variants) will get persisted into a column in the database.\n2. Name your properties in the **lower camel case** way. e.g. `productName` will be stored in datebase by named `product_name`.\n3. Send `- (void)save;` method to save the data object to database.\n4. Query:\n\n\n\t\t// get all Product objects from database\n\t\tNSArray *allObjects = [Product allObjects];\n\t\t// query with sql, sql starts with 'WHERE'\n\t\tProduct *aProduct = (Product *)[Product findFirstByCriteria:@\"WHERE pid = 100\"];\n\t\t\n\t\tNSArray *someProducts = [Product findByCriteria:@\"WHERE price \u003e 20.0 LIMIT 0,30\"]; \n\n\n5. Indexes: just override `+ (NSArray *)indices;` class method.\n\n\t\t+ (NSArray *)indices\n\t\t{\n\t\t        return [NSArray arrayWithObjects:\n\t\t                [NSArray arrayWithObjects:@\"pID\", nil],\n\t\t                [NSArray arrayWithObjects:@\"price\", nil]\n\t\t                , nil];\n\t\t}\n\n6. To filter properties that does not need to be saved to the database, just override `+ (NSArray *)transients;` class method.\n\n\t\t+ (NSArray *)transients\n\t\t{\n\t\t        return [NSArray arrayWithObjects:@\"isNewlyAdded\", nil];\n\t\t}\n\n7. `- (void)deleteObject;`\n8. `+ (void)clearCache;`\n9. `[SQLiteInstanceManager reset];`\n10. `[[SQLiteInstanceManager sharedManager] setDatabaseFilepath:dbPath];`;\n\nYou may check out the file `SQLitePersistentObject.h` or the SPOSample project for more.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FElfSundae%2FSQLitePersistentObjects","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FElfSundae%2FSQLitePersistentObjects","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FElfSundae%2FSQLitePersistentObjects/lists"}