package Ġapps . ric as ares . com . data . cache . db Ċ Ċ import Ġandroid . arch . persistence . room . Dao Ċ import Ġandroid . arch . persistence . room . Insert Ċ import Ġandroid . arch . persistence . room . Query Ċ import Ġapps . ric as ares . com . data . entity . Children Data Ċ import Ġio . reactivex . Single Ċ Ċ /** Ċ Ġ* ĠCreated Ġby Ġr ic ardo Ġcas are z Ġon Ġ 1 / 2 4 / 1 8 . Ċ Ġ*/ Ċ @ Dao Ċ interface ĠRed dit Response Dao Ġ{ ĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġposts ĠORDER ĠBY Ġindex In Response ĠASC ") ĊĠĠĠ Ġfun ĠgetAll () Ġ: ĠSingle < List < Children Data >> ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġposts ĠWHERE Ġsub reddit Ġ= Ġ: sub reddit ĠORDER ĠBY Ġindex In Response ĠASC ") ĊĠĠĠ Ġfun ĠgetBy Sub reddit ( sub reddit Ġ: ĠString ) Ġ: ĠSingle < List < Children Data >> ĊĊĠĠĠ Ġ@ Insert ĊĠĠĠ Ġfun Ġinsert ( posts : ĠList < Children Data >) ĊĊĠĠĠ Ġ@ Query (" SELECT ĠMAX ( index In Response ) Ġ+ Ġ 1 ĠFROM Ġposts ĠWHERE Ġsub reddit Ġ= Ġ: sub reddit ") ĊĠĠĠ Ġfun ĠgetNext Index In Sub reddit ( sub reddit : ĠString ) Ġ: ĠInt ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM Ġposts ĠWHERE Ġsub reddit Ġ= Ġ: sub reddit ") ĊĠĠĠ Ġfun Ġdelete By Sub reddit ( sub reddit : ĠString ) ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM Ġposts ") ĊĠĠĠ Ġfun Ġdelete All () Ċ }