我正在尝试使用 LazyVerticalGrid 显示分页项目。我正在尝试的代码如下所示。
val categories = repo.categories.collectAsLazyPagingItems()
LazyVerticalGrid(
cells = GridCells.Fixed(2),
modifier = Modifier.padding(8.dp)
) {
items(categories) { category ->
Box(Modifier.padding(8.dp)) {
CategoryView(category)
}
}
}
Run Code Online (Sandbox Code Playgroud)
请注意,我已经导入了androidx.paging.compose.items和androidx.paging.compose.collectAsLazyPagingItems。也categories属于类型LazyPagingItems<Category>。
LazyColumn它可以与和完美配合LazyRow,但不能LazyVerticalGrid。我收到的错误是:
Type mismatch.
Required:
Int
Found:
LazyPagingItems<Category>
Run Code Online (Sandbox Code Playgroud) 我正在尝试TEXT使用 Gorm ORM创建一个列,但该列仍创建为VARCHAR(225). 下面是我要迁移到表的结构。
type TextDump struct {
*gorm.Model
Title string `gorm:"varchar(50)" json:"title" binding:"required"`
Text string `gorm:"text" json:"text" binding:"required"`
Count int `json:"count"`
ChannelID int `json:"channel_id" binding:"required"`
}
Run Code Online (Sandbox Code Playgroud)
该text列被创建为VARCHAR而不是TEXT。
我正在尝试使用 sequelize.js addIndex 函数创建索引,该索引已创建但不是使用 indexName 选项中指定的名称。
我正在使用下面的代码
queryInterface.addIndex('Item',
['name', 'description'], {
indicesType: 'FULLTEXT',
indexName: 'idx_item_fulltext'
})
Run Code Online (Sandbox Code Playgroud)
运行迁移后,将使用名称“item_name_description”而不是我指定的名称“idx_item_fulltext”创建索引。