Older/Server/Database.h

25 lines
503 B
C
Raw Normal View History

2023-12-30 00:15:03 +08:00
#ifndef __DATABASE_H__
#define __DATABASE_H__
2023-12-30 01:19:36 +08:00
#include "Singleton.h"
2023-12-30 00:15:03 +08:00
#include <string>
2023-12-30 01:19:36 +08:00
struct sqlite3;
2023-12-30 00:15:03 +08:00
class Database {
2023-12-30 01:19:36 +08:00
friend class Amass::Singleton<Database>;
2023-12-30 00:15:03 +08:00
public:
2023-12-30 01:19:36 +08:00
~Database();
2023-12-30 00:15:03 +08:00
bool open(const std::string &path);
2023-12-30 01:19:36 +08:00
void addTask(uint64_t createTime, const std::string &content, bool finished = false);
void setTaskFinished(int id, bool finished, uint64_t finishedTime);
protected:
void initialize();
private:
sqlite3 *m_sqlite3 = nullptr;
2023-12-30 00:15:03 +08:00
};
#endif // __DATABASE_H__