diff options
| author | Lizzy Hunt <lizzy.hunt@usu.edu> | 2024-03-26 16:00:05 -0600 |
|---|---|---|
| committer | Lizzy Hunt <lizzy.hunt@usu.edu> | 2024-03-26 16:00:05 -0600 |
| commit | fe22956d5dbdeb2b80a9e56b46abe2be9f2bfcdb (patch) | |
| tree | 6111f03c2da4eb42aff03cda72157a8961da27e8 /database/conn.go | |
| parent | 27aab70386c68f3a0f22c52e72b91cf16b289100 (diff) | |
| download | hatecomputers.club-fe22956d5dbdeb2b80a9e56b46abe2be9f2bfcdb.tar.gz hatecomputers.club-fe22956d5dbdeb2b80a9e56b46abe2be9f2bfcdb.zip | |
initial commit
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 +} |
