aboutsummaryrefslogtreecommitdiff
path: root/src/db.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/db.h')
-rw-r--r--src/db.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/db.h b/src/db.h
new file mode 100644
index 0000000..2473d93
--- /dev/null
+++ b/src/db.h
@@ -0,0 +1,20 @@
+#ifndef BOKF_DB_H
+#define BOKF_DB_H
+
+#include <sqlite3.h>
+#include <stdint.h>
+
+#define BOKF_SCHEMA_VERSION 2
+
+int db_open(const char *path, sqlite3 **out, char **err);
+int db_migrate(sqlite3 *db, char **err);
+int db_exec(sqlite3 *db, const char *sql, char **err);
+int db_create_user(sqlite3 *db, const char *username, const char *display_name,
+ const char *password, int is_admin, int64_t *out_id,
+ char **err);
+char *db_membership_role(sqlite3 *db, int64_t org_id, int64_t user_id);
+char *db_setting(sqlite3 *db, int64_t org_id, const char *key);
+int64_t db_count(sqlite3 *db, const char *sql);
+int64_t db_last_id(sqlite3 *db);
+
+#endif