写入Realm的嵌套模式

时间:2019-10-10 11:40:31

标签: nested realm schema realm-list

基于我的api响应,我为领域创建了架构,但无法根据架构将值推入领域。请让我知道有什么办法做

 export const WORKFLOW_SCHEMA = 'work_flow';
export const WORKFLOW_NAMES_SCHEMA = 'workflow_name';
export const WorkflowNamesSchema = {
   name: WORKFLOW_SCHEMA,
   primaryKey :'workflow_Name',
   properties: {
     workflow_Name: 'string',
     default_State: 'int',
     states: { type: 'list', objectType: WORKFLOW_NAMES_SCHEMA }
   }
 };

export const NEXTSTATE_SCHEMA = 'next_states';
export const WorkFlowSchema = {
  name: WORKFLOW_NAMES_SCHEMA,
  primaryKey :'state_ID',
  properties: {
    state_ID: 'int',
    action_Name: 'string',
    state: 'string',
    next_States: { type: 'list', objectType: NEXTSTATE_SCHEMA }
  }
};

export const NextStatesSchema = {
  name: NEXTSTATE_SCHEMA,
  properties: {
    action: 'string',
    state: 'string',
  },
};

0 个答案:

没有答案