Older/Server/Database/Database.h
2024-01-03 22:44:36 +08:00

29 lines
619 B
C++

#ifndef __DATABASE_H__
#define __DATABASE_H__
#include "Singleton.h"
#include "Task.h"
#include <string>
struct sqlite3;
class Database {
friend class Amass::Singleton<Database>;
public:
~Database();
bool open(const std::string &path);
Tasks tasks();
bool addTask(uint64_t createTime, const std::string &content, const std::string &comment = "",
bool finished = false);
bool removeTask(int id);
void setTaskFinished(int id, bool finished, uint64_t finishedTime);
protected:
void initialize();
private:
sqlite3 *m_sqlite3 = nullptr;
};
#endif // __DATABASE_H__