React Native 西瓜Db:如何将字符串数组作为模式中列类型传递?

tcomlyy6  于 2023-10-22  发布在  React
关注(0)|答案(2)|浏览(111)

我想把serverNames的类型设置为一个字符串数组,但在watermelon中它只支持布尔值,字符串和数字,有人能帮我吗?

export const settingSchema = tableSchema({
  name: 'SETTINGS',
  columns: [
    { name: 'serverId', type: 'number' },
    { name: 'server', type: 'string' },
    { name: 'base_url', type: 'string' },
    { name: 'serverNames', type: 'string', },//<-----serverNames,type:'[string]
    { name: 'amberIcon', type: 'boolean' },
    { name: 'showAllResident', type: 'boolean' },
    { name: 'showAllTask', type: 'boolean' },
    { name: 'filterStart', type: 'number' },
    { name: 'filterEnd', type: 'number' },
    { name: 'searchedText', type: 'string' },
    { name: 'currentTab', type: 'number' },
    { name: 'appInit', type: 'boolean' },
    { name: 'performRefresh', type: 'boolean' },
    { name: 'slowMessageDisplay', type: 'boolean' },
    { name: 'backgroundListener', type: 'boolean' },
    { name: 'displayResidentHeader', type: 'boolean' },
    { name: 'currentResident', type: 'string', isOptional: true },
  ]
})
ocebsuys

ocebsuys1#

你可以使用JSON字段类型,我相信。https://nozbe.github.io/WatermelonDB/Advanced/AdvancedFields.html#json

km0tfn4u

km0tfn4u2#

**更新2023年10月 *

使用新的url文档here

相关问题