I'm dreaming up a lightweight database solution for a hobby project. The main sort of "record" I need to store is time intervals. These intervals will be tied to a user record.
users.txt
1 Tim
2 Tom
intervals.txt
2020-07-06T07:20:11 2020-07-06T07:21:14 2
2020-07-06T07:21:33 2020-07-06T07:22:37 2
2020-07-06T07:21:40 2020-07-06T07:23:12 1
This is a simplified example but that's the basic idea. To get Tom's time, I'd find every line with a "2" at the end and calc the time difference.
Please tell me why this is a bad idea and why I should use a real db instead. I'm looking for general critique/discussion, not specific nitpicks ("you should cache the time diff" and "store the dates in [format XYZ]" are not helpful). If there is something fundamentally wrong with this general concept I'd like to know.
If it's just reinventing the wheel, I'm fine with that. I like reinventing the wheel because it helps me to better understand and appreciate wheels.
edit: After composing this question I learned the term "flat-file database" so I realize I'm not inventing some hacky, ill-advised pattern. I'd just never encountered it so I thought I was clever :) I'd still like to hear people's thoughts.
Aucun commentaire:
Enregistrer un commentaire