package Ġcom . example . home inventory . repository Ċ Ċ import Ġandroidx . annotation . Worker Thread Ċ import Ġcom . example . home inventory . dao . Category Dao Ċ import Ġcom . example . home inventory . model . Category Ċ import Ġio . reactivex . rx java 3 . core . Single Ċ import Ġkotlinx . coroutines . flow . Flow Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠCategory Repository Ċ @ Inject Ċ constructor ( private Ġvar Ġcategory Dao : ĠCategory Dao ) Ġ{ ĊĊĠĠĠ Ġval Ġall Category Ġ: ĠFlow < List < Category >> Ġ= Ġcategory Dao . selectAll Category () ĊĊĠĠĠ Ġ@ Worker Thread ĊĠĠĠ Ġsuspend Ġfun Ġinsert Category Data ( category : ĠCategory ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcategory Dao . insert Category Data ( category ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Worker Thread ĊĠĠĠ Ġsuspend Ġfun Ġupdate Category ( category : ĠCategory ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcategory Dao . update Category ( category ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Worker Thread ĊĠĠĠ Ġsuspend Ġfun Ġdelete Category ( category : ĠCategory ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcategory Dao . delete Category ( category ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġselect Category ( id Ġ: ĠInt ) Ġ: ĠSingle < String > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġcategory Dao . select Category ( id ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Worker Thread ĊĠĠĠ Ġsuspend Ġfun Ġdelete All () Ġ{ ĊĠĠĠĠĠĠĠ Ġcategory Dao . delete All () ĊĠĠĠ Ġ} Ċ }