package safeluck.drive.evaluation.DB.lightdb
|
|
import kotlinx.coroutines.Dispatchers.IO
|
import kotlinx.coroutines.withContext
|
|
/**DriveJudge
|
* Created by lzw on 2021/1/15. 10:01:31
|
* 邮箱:632393724@qq.com
|
* All Rights Saved! Chongqing AnYun Tech co. LTD
|
*/
|
class LightAnswersRepository private constructor(
|
private val lightdefaulDao: LightAllAnswerDao
|
){
|
|
|
|
|
fun getLightAllQuestions(question_id:Int) =lightdefaulDao.getCurrQuest2Answers(question_id)
|
suspend fun updateAnswerChoose(id: Int, flag: Int) {
|
withContext(IO){
|
lightdefaulDao.updateAnswerChoose(id,flag);
|
}
|
}
|
|
fun getLightAllAnswers()=lightdefaulDao.getAllAnswers()
|
|
|
companion object{
|
@Volatile
|
private var instance:LightAnswersRepository ?= null
|
|
fun getInstance(lightdefaulDao: LightAllAnswerDao)= instance?: synchronized(this){
|
instance?: LightAnswersRepository(lightdefaulDao).also { instance = it }
|
}
|
}
|
}
|