-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
989f8e7
commit fa08862
Showing
11 changed files
with
147 additions
and
76 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
16 changes: 7 additions & 9 deletions
16
app/src/main/java/devs/redfox/local_e_commerce/database/ProductDao.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
package devs.redfox.local_e_commerce.database | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Delete | ||
import androidx.room.Insert | ||
import androidx.room.Query | ||
import androidx.lifecycle.LiveData | ||
import androidx.room.* | ||
|
||
@Dao | ||
interface ProductDao { | ||
|
||
@Insert | ||
suspend fun insertProduct(product:ProductModel) | ||
@Insert(onConflict = OnConflictStrategy.IGNORE) | ||
suspend fun insertProduct(vararg product:ProductModel) | ||
|
||
@Delete | ||
suspend fun deleteProduct(product:ProductModel) | ||
suspend fun deleteProduct(vararg product:ProductModel) | ||
|
||
@Query("SELECT * FROM products") | ||
fun getAllProducts():List<ProductModel> | ||
fun getAllProducts(): LiveData<List<ProductModel>> | ||
|
||
@Query("SELECT * FROM products WHERE productId = :id") | ||
fun isExit(id:String):ProductModel | ||
fun isExit(id : String) : ProductModel | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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