1
zhujie
2025-04-15 879ec1ae04b37eb7bf9357903d10acc860d84d5b
app/src/main/java/com/example/firstapp/model/DailyStat.kt
@@ -1,17 +1,20 @@
package com.example.firstapp.model
import androidx.room.DatabaseView
import androidx.room.ColumnInfo
import androidx.room.Ignore
@DatabaseView(
    """
    SELECT substr(createtime, 1, 10) as date,
    SELECT substr(createTime, 1, 10) as date,
           COUNT(*) as count 
    FROM code 
    GROUP BY substr(createtime, 1, 10)
    GROUP BY substr(createTime, 1, 10)
    """
)
data class DailyStat(
    val date: String,
    val count: Int,
    val weekStart: Long? = null
    @ColumnInfo(name = "weekStart")
    val weekStart: String? = null
)