This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Retriever r = ForSure.employeesTable() // <-- enter the employees table Resolver context | |
| .find().byNotDeleted() // <-- enter the employees table Finder context | |
| .and().byIdBetweenInclusive(2).and(10) | |
| .then() // <-- exit the employees table Finder context | |
| .joinPositionsTable(FSJoin.Type.INNER) // <-- enter positions table Resolver context | |
| .order().byTitle(OrderBy.ORDER_ASC) // <-- enter positions table OrderBy context | |
| .then() // <-- exit positions table OrderBy context | |
| .find().byNotDeleted() // <-- enter positions table Finder context | |
| .and().byNot("President") | |
| .then() // <-- exit positions table Finder context |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Android (forsuredbandroid-contentprovider) | |
| package com.fsryan.forsuredb.example; | |
| import android.app.Application; | |
| import com.fsryan.forsuredb.FSDBHelper; | |
| import com.fsryan.forsuredb.ForSureAndroidInfoFactory; | |
| import com.fsryan.forsuredb.gsonserialization.FSDbInfoGsonSerializer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Retriever r = ForSure.employeesTable() | |
| .find().byNotDeleted() | |
| .and().byFirstName("FSRyan") | |
| .and().byLastName("Developer") | |
| .then() | |
| .get(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.fsryan.forsuredb.example.data.db; | |
| import com.fsryan.forsuredb.annotations.FSColumn; | |
| import com.fsryan.forsuredb.annotations.FSDefault; | |
| import com.fsryan.forsuredb.annotations.FSForeignKey; | |
| import com.fsryan.forsuredb.annotations.FSTable; | |
| import com.fsryan.forsuredb.annotations.Unique; | |
| import com.fsryan.forsuredb.api.FSGetApi; | |
| import com.fsryan.forsuredb.api.Retriever; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apply plugin: /*'com.android.application', 'com.android.library', or 'java'*/ | |
| apply plugin: 'com.fsryan.gradle.forsuredb' | |
| forsuredb { | |
| /*...*/ | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Android | |
| dependencies { | |
| /* ... */ | |
| annotationProcessor "com.fsryan.forsuredb:forsuredbcompiler:$forsuredbversion" | |
| /* ... */ | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ ./gradlew :app:dbMigrate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| forsuredb { | |
| applicationPackageName = 'com.fsryan.forsuredb.example' | |
| resultParameter = "com.fsryan.forsuredb.queryable.DirectLocator" | |
| recordContainer = "com.fsryan.forsuredb.queryable.FSContentValues" | |
| migrationDirectory = 'app/src/main/assets' | |
| appProjectDirectory = 'app' | |
| resourcesDirectory = 'app/src/main/resources' | |
| fsSerializerFactoryClass = 'com.fsryan.forsuredb.example.JsonAdapterFactory' | |
| dbmsIntegratorClass = 'com.fsryan.forsuredb.sqlitelib.SqlGenerator' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int rowsAffected = ForSure.myTable() // <-- the generated ForSure class serves as your entrypoint | |
| .find() // <-- start narrowing the number of records and columns to update | |
| .byIntColumnBetween(3).andInclusive(10) // <-- set bounds (3, 10] | |
| .and().byNotDeleted() // <-- add additional condition that the record must not be "soft deleted" | |
| .then() // <-- end narrowing number of records and columns to return | |
| .set() // <-- enter insert/update/delete section | |
| .hardDelete(); // <-- perform a hard deletion--actually deleting the record | |
| System.out.println("Number of records deleted: " + rowsAffected); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SaveResult<Uri> result = ForSure.myTable() | |
| .find() // <-- start narrowing the number of records and columns to update | |
| .byIntColumnBetween(3).andInclusive(10) // <-- set bounds (3, 10] | |
| .and().byNotDeleted() // <-- add additional condition that the record must not be "soft deleted" | |
| .then() // <-- end narrowing number of records and columns to return | |
| .set() // <-- start setting column values to update | |
| .stringColumn("Your int_column value is greater than three and less than or equal to 10") | |
| .save(); | |
| System.out.println("Number of records updated: " + result.rowsAffected()); |