diff options
| author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-02 16:57:57 -0800 |
|---|---|---|
| committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-02 16:57:57 -0800 |
| commit | 94dd1ca677c716975d43f323c97ea26f8fd4c962 (patch) | |
| tree | 7eaf4f32af0a180457f935d5f2fdff941018a12f /database/conn.go | |
| download | something-94dd1ca677c716975d43f323c97ea26f8fd4c962.tar.gz something-94dd1ca677c716975d43f323c97ea26f8fd4c962.zip | |
initial commit by simponic-infra
Diffstat (limited to 'database/conn.go')
| -rw-r--r-- | database/conn.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/database/conn.go b/database/conn.go new file mode 100644 index 0000000..be27586 --- /dev/null +++ b/database/conn.go @@ -0,0 +1,17 @@ +package database + +import ( + "database/sql" + _ "github.com/mattn/go-sqlite3" + "log" +) + +func MakeConn(databasePath *string) *sql.DB { + log.Println("opening database at", *databasePath, "with foreign keys enabled") + dbConn, err := sql.Open("sqlite3", *databasePath+"?_foreign_keys=on") + if err != nil { + panic(err) + } + + return dbConn +} |
