1
0
Fork 0
forked from jriou/coller

Several fixes and features

- Commit database transactions
- Listen to all interfaces by default
- Use logger in collerd
- Add docker-compose file with PostgreSQL

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2025-08-26 12:28:32 +02:00
commit 7d7614637b
Signed by: jriou
GPG key ID: 9A099EDA51316854
7 changed files with 45 additions and 6 deletions

View file

@ -21,7 +21,7 @@ type Note struct {
}
// Generate ID and compress content before saving to the database
func (n *Note) BeforeCreate(tx *gorm.DB) (err error) {
func (n *Note) BeforeCreate(trx *gorm.DB) (err error) {
for i := 0; i < ID_MAX_RETRIES; i++ {
if n.ID != "" {
continue
@ -30,7 +30,7 @@ func (n *Note) BeforeCreate(tx *gorm.DB) (err error) {
id := internal.GenerateChars(idLength)
var note Note
tx.Where("id = ?", id).Find(&note)
trx.Where("id = ?", id).Find(&note)
if note.ID == "" {
n.ID = id