- 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.
- OpenStack Cloud Computing Cookbook(Third Edition)
- C# 2012程序設計實踐教程 (清華電腦學堂)
- Getting Started with PowerShell
- Bootstrap 4:Responsive Web Design
- C++ 從入門到項目實踐(超值版)
- 深入剖析Java虛擬機:源碼剖析與實例詳解(基礎卷)
- Image Processing with ImageJ
- HTML5+CSS3+JavaScript 從入門到項目實踐(超值版)
- 跟戴銘學iOS編程:理順核心知識點
- 美麗洞察力:從化妝品行業看顧客需求洞察
- 微信公眾平臺開發最佳實踐
- 鋁合金陽極氧化與表面處理技術(第三版)
- Mastering Unity 2017 Game Development with C#(Second Edition)
- 深度學習的數學:使用Python語言
- 測試架構師修煉之道:從測試工程師到測試架構師(第2版)