在YDN-DB中将多列定义为PK
使用ydn db定义架构时,我可以使用以下代码将单个列定义为PK:在YDN-DB中将多列定义为PK,ydn-db,Ydn Db,使用ydn db定义架构时,我可以使用以下代码将单个列定义为PK: var products = { name: 'products', keyPath: 'id_product', autoIncrement: true, indexes: [ {keyPath: 'id_product'}, {keyPath: 'id_supplier'} ] }; var schema = { stores: [produc
var products = {
name: 'products',
keyPath: 'id_product',
autoIncrement: true,
indexes: [
{keyPath: 'id_product'},
{keyPath: 'id_supplier'}
]
};
var schema = {
stores: [products]
};
如何定义一个具有两列或更多列的PK的存储(表)?谢谢
如何定义一个具有两列或更多列的PK的存储(表)
我不确定是否回答了你的问题。IndexedDB(ynd db非常以IDB为中心)只能有一个PK。但主键可以是使用多个键路径(列)组成的复合键。是这样定义的
var products = {
name: 'products',
keyPath: ['id_category', id_product']
};
如何定义一个具有两列或更多列的PK的存储(表)
我不确定是否回答了你的问题。IndexedDB(ynd db非常以IDB为中心)只能有一个PK。但主键可以是使用多个键路径(列)组成的复合键。是这样定义的
var products = {
name: 'products',
keyPath: ['id_category', id_product']
};