使用Ionic存储或数据库(NoSQL,Sqlite等)

问题描述 投票:0回答:1

我将创建一个应用程序(iOS和Android),将数据保存到用户设备(文本,图像,文件等),并将留在用户设备上,直到他们决定将其发送到服务器。我可以使用sqlite数据库或使用离子存储来完成它,但我不知道最佳实践是什么

为简单起见,我将只提供两种类型的物品 - notesrecords

笔记结构

notes = { 
     description: this.description,
     'otherText': this.otherText,
     fileOrImage1: this.imageOrFileURL1,
     fileOrImage2: this.imageOrFileURL2,
    ..... Unlimited number of fileOrImageURL'S here
};

记录结构

records = { 
     name: this.name,
     'description': this.description,
     // NOTE: These files and images are different than the ones above. They will be in separate components 
     fileOrImage1: this.imageOrFileURL1,  
     fileOrImage2: this.imageOrFileURL2,
    ..... Unlimited number of fileOrImageURL'S here
}

用户将首先将数据存储在设备上,并且只有在用户将数据发送到服务器时才会上传。一旦上传,它就会被删除。

可以有许多笔记和记录,每个可以说25个。我应该使用Ionic Storage或类似sqlite数据库吗?如果我使用离子存储,我将需要为每个音符和记录创建一个唯一的ID并保存。

如果有人有更好的方法,我愿意改变我的做法。我还在规划阶段

ionic-framework
1个回答
0
投票

我使用sqlite数据库作为我用Ionic做的应用程序,我选择的原因是我可以轻松地查询数据,就像任何数据库一样。

© www.soinside.com 2019 - 2024. All rights reserved.