Documentation
¶
Index ¶
- func InitDB(dbPath string) (*sql.DB, error)
- type DB
- type SQLiteDB
- func (s *SQLiteDB) Close() error
- func (s *SQLiteDB) GetAllEntries() ([]*models.Entry, error)
- func (s *SQLiteDB) GetEntriesByCategory(category models.Category) ([]*models.Entry, error)
- func (s *SQLiteDB) GetEntriesFromLastWeek() ([]*models.Entry, error)
- func (s *SQLiteDB) GetEntryByID(id string) (*models.Entry, error)
- func (s *SQLiteDB) GetEntryCount() (int, error)
- func (s *SQLiteDB) SaveEntry(entry *models.Entry) error
- func (s *SQLiteDB) UpdateEntry(entry *models.Entry) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DB ¶
type DB interface {
SaveEntry(entry *models.Entry) error
UpdateEntry(entry *models.Entry) error
GetAllEntries() ([]*models.Entry, error)
GetEntriesByCategory(category models.Category) ([]*models.Entry, error)
GetEntryByID(id string) (*models.Entry, error)
GetEntryCount() (int, error)
GetEntriesFromLastWeek() ([]*models.Entry, error)
Close() error
}
DB is the interface for database operations
type SQLiteDB ¶
type SQLiteDB struct {
// contains filtered or unexported fields
}
SQLiteDB implements the DB interface with SQLite
func (*SQLiteDB) GetAllEntries ¶
GetAllEntries retrieves all entries from the database
func (*SQLiteDB) GetEntriesByCategory ¶
GetEntriesByCategory retrieves entries by category
func (*SQLiteDB) GetEntriesFromLastWeek ¶
GetEntriesFromLastWeek retrieves entries from the past 7 days
func (*SQLiteDB) GetEntryByID ¶
GetEntryByID retrieves an entry by ID
func (*SQLiteDB) GetEntryCount ¶
GetEntryCount returns the total number of entries
Click to show internal directories.
Click to hide internal directories.