package Ġcom . fl am yo ad . ts uk iv iew er . db . dao Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . room .* Ċ import Ġcom . fl am yo ad . ts uk iv iew er . db . type converter . Folder Converter Ċ import Ġcom . fl am yo ad . ts uk iv iew er . model . Collection Ċ import Ġcom . fl am yo ad . ts uk iv iew er . model . Collection With C riter ias Ċ import Ġjava . io . File Ċ Ċ @ Dao Ċ @ Type Converters ( Folder Converter :: class ) Ċ interface ĠCollection Dao Ġ{ ĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . REPLACE ) ĊĠĠĠ Ġsuspend Ġfun Ġinsert ( collection : ĠCollection ): ĠLong ĊĊĠĠĠ Ġ@ Delete ĊĠĠĠ Ġsuspend Ġfun Ġdelete ( collection : ĠCollection ) ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM Ġcollection ĠWHERE Ġid Ġ= Ġ: id ") ĊĠĠĠ Ġsuspend Ġfun Ġdelete ( id : ĠLong ) ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġcollection ") ĊĠĠĠ Ġfun ĠgetAll (): ĠLive Data < List < Collection >> ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġcollection ") ĊĠĠĠ Ġsuspend Ġfun ĠgetAll Blocking (): ĠList < Collection > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġcollection ") ĊĠĠĠ Ġfun ĠgetAll With C riter ias (): ĠLive Data < List < Collection With C riter ias >> ĊĊĠĠĠ Ġ@ Query (""" ĊĠĠĠĠĠĠĠ ĠSELECT Ġ* ĠFROM Ġcollection ĠĊĠĠĠĠĠĠĠ ĠWHERE Ġname ĠLIKE Ġ'%' Ġ|| Ġ: keyword Ġ|| Ġ'%' ĊĠĠĠ Ġ"" ") ĊĠĠĠ Ġfun ĠgetAll With C riter ias ( keyword : ĠString ): ĠLive Data < List < Collection With C riter ias >> ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġcollection ĠWHERE Ġid Ġ= Ġ: collection Id ") ĊĠĠĠ Ġfun Ġget ( collection Id : ĠLong ): ĠLive Data < Collection > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġcollection ĠWHERE Ġid Ġ= Ġ: collection Id ") ĊĠĠĠ Ġsuspend Ġfun Ġget Blocking ( collection Id : ĠLong ): ĠCollection ĊĊĊĠĠĠ Ġ@ Query (""" ĊĠĠĠĠĠĠĠ ĠUPDATE Ġcollection ĠĊĠĠĠĠĠĠĠ ĠSET Ġcover Photo Ġ= Ġ: thumbnail ĠĊĠĠĠĠĠĠĠ ĠWHERE Ġid Ġ= Ġ: collection Id ĊĠĠĠĠĠĠĠ Ġ"" ") ĊĠĠĠ Ġsuspend Ġfun Ġupdate Thumbnail ( collection Id : ĠLong , Ġthumbnail : ĠFile ) ĊĊĠĠĠ Ġ@ Query (" UPDATE Ġcollection ĠSET Ġcover Photo Ġ= Ġ'' ĠWHERE Ġid Ġ= Ġ: id Ġ") ĊĠĠĠ Ġsuspend Ġfun Ġdelete Thumbnail ( id : ĠLong ) Ċ }