occlum/demos/golang/go_sqlite/README.md
2020-09-27 14:21:58 +08:00

1.1 KiB

Use Golang and SQLite with Occlum

This project demonstrates how Occlum enables Golang programs with SQLite library calls running in SGX enclaves. The way to use a SQL (or SQL-like) database in Go is through the database/sql package. The SQL package exposes an ideal set of generic APIs for a variety of SQL or SQL-like databases. The SQL package itself must be used in conjunction with a database driver package.

The demo program is based on a widely used sqlite3 driver conforming to the built-in database/sql interface and passing the compatibility test suite at https://github.com/bradfitz/go-sql-test. You can run the Golang SQLite demo on Occlum via

./run_go_sqlite_demo.sh

The demo program adds a database source file golang_sql_driver.db, creates a table SqlDrivers, inserts a list of Golang SQL database driver records, queries all records, and prints them out.