c++ - 哪种数据结构最适合可扩展的用户数据库
问题描述
我正在尝试创建一个数据结构,该结构将容纳未知数量的用户,并将随着程序的进行而扩展。我正在使用一个结构,它将有多个实例放入结构中,现在我想知道我应该使用哪种结构来扩展需要随机检查和访问的用户群。
我正在使用的结构:
struct Bank{
string userName;
string password;
string legalName;
int accountNum;
string accountType;
map<string, int> accountBal;
list<string> recPayments;
map<string, int> CardNums;
map<string, list<string>> transactions;
};
谢谢
解决方案
当我看到一个像数据库一样行走、像数据库一样游泳、像数据库一样嘎嘎作响的结构时,我称该结构为数据库。
本质上,您尝试创建关系数据库。
struct Account {
string userName;
string password;
string legalName;
int accountNum;
string accountType;
};
以及以下关系表。
map<string, int> accountBal;
list<string> recPayments;
map<string, int> CardNums;
map<string, list<string>> transactions;
推荐阅读
- sql - 我需要知道 Azure SQL DB 中是否有类似于“sys.dm_pdw_request_steps”的 DMV
- json - 在 ruby 中自动转换 JSON 编码的数据
- java - Spring Tool Suite 中的错误“生命周期配置未涵盖插件执行:org.apache.maven.plugins
- xml - xslt 在同一级别上对多个 for-each 循环进行排序
- java - Java:在绘图线上标记的某些坐标
- jquery - 如何使用 ajax 提交多个表单并等待所有结果?
- java - 代码改进:统计数组中元素出现的次数,返回重复次数最多的元素
- smalltalk - 如何更改 SpTextPresenter 中的字体?
- kubernetes - Nginx 控制器中的 SSL 直通问题
- php - 如何处理elasticsearch range Beetween 2个日期