- Creative Projects for Rust Programmers
- Carlo Milanesi
- 201字
- 2021-06-18 19:01:59
Putting it all together
You should now know enough to build an example that does what we described at the beginning of the chapter. We have learned the following:
- How to read a TOML file to parameterize the program
- How to load the data regarding products and sales into memory, specified in a JSON file and in an XML file
- How to store all of this data in three places: a SQLite DB file, a PostgreSQL database, and a Redis key-value store
The source code of the complete example is found in the transformer project. To run it, open its folder and type in cargo run ../data/config.toml. If everything is successful, it will recreate and populate the SQLite database contained in the data/sales.db file, the PostgreSQL database, which can be accessed from localhost on port 5432 and is named Rust2018, and the Redis store, which can be accessed from localhost. Then, it will query the SQLite and PostgreSQL databases for the number of rows in their tables, and it will print the following:
SQLite #Products=4.
SQLite #Sales=5.
PostgreSQL #Products=4.
PostgreSQL #Sales=5.
So, we have now seen a rather broad example of data manipulation.
- 手機(jī)安全和可信應(yīng)用開發(fā)指南:TrustZone與OP-TEE技術(shù)詳解
- DevOps:軟件架構(gòu)師行動指南
- FreeSWITCH 1.8
- 零基礎(chǔ)學(xué)C++程序設(shè)計
- 騰訊iOS測試實(shí)踐
- SpringMVC+MyBatis快速開發(fā)與項目實(shí)戰(zhàn)
- 編程卓越之道(卷3):軟件工程化
- ASP.NET Core Essentials
- Learning Laravel 4 Application Development
- Java 11 Cookbook
- MATLAB for Machine Learning
- OpenResty完全開發(fā)指南:構(gòu)建百萬級別并發(fā)的Web應(yīng)用
- 響應(yīng)式架構(gòu):消息模式Actor實(shí)現(xiàn)與Scala、Akka應(yīng)用集成
- Mastering Web Application Development with AngularJS
- Learning VMware vSphere