package Ġcom . android . m om oney 1 0 1 . data Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . room .* Ċ import Ġcom . android . m om oney 1 0 1 . model . Expense Ċ Ċ // Data ĠAccess ĠObject Ġfor Ġexpense Ċ @ Dao Ċ interface ĠExp ense Dao Ġ{ ĊĊĠĠĠ Ġ// Function Ġthat Ġinsert Ġthe Ġparameter Ġinto Ġthe Ġdatabase ĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . IGNORE ) ĊĠĠĠ Ġsuspend Ġfun Ġadd Expense ( expense : ĠExp ense ) ĊĊĠĠĠ Ġ// Function Ġthat Ġwill Ġread Ġfrom Ġthe Ġdatabase Ġorder Ġby ĠID ĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM ĠExp ense List Table ĠORDER ĠBY Ġid ĠASC ") ĊĠĠĠ Ġfun Ġread All Expense Data (): ĠLive Data < List < Expense >> ĊĊĠĠĠ Ġ// Function Ġthat Ġwill Ġdelete Ġparameter Ġexpense Ġitem Ġfrom Ġthe Ġdatabase ĊĠĠĠ Ġ@ Delete ĊĠĠĠ Ġsuspend Ġfun Ġdelete Expense ( expense : ĠExp ense ) ĊĊĠĠĠ Ġ// Query Ġto Ġdelete Ġall Ġthe Ġexpense Ġitems Ġfrom Ġtable ĊĠĠĠ Ġ@ Query (" DELETE Ġfrom ĠExp ense List Table ") ĊĠĠĠ Ġsuspend Ġfun Ġdelete All Exp enses () ĊĊĠĠĠ Ġ// Function Ġthat Ġwill Ġquery Ġthe Ġtotal Ġamount Ġof Ġexpense ĊĠĠĠ Ġ@ Query (" SELECT ĠSUM ( expense Amount ) ĠFROM ĠExp ense List Table ") ĊĠĠĠ Ġfun ĠgetTotal Expense (): Double Ċ Ċ }