Skip to content

Instantly share code, notes, and snippets.

View lundha's full-sized avatar

Martin Lund Haug lundha

View GitHub Profile
@lundha
lundha / gist:d9848194575b9d6303c3d151e4b6e6bc
Created October 5, 2026 17:38
# Personal Ledger – Privacy and Terms
This application is used only by its owner, to read the owner's own
bank accounts. No service is offered to other people.
- Data: account details, balances and transactions from the owner's banks.
- Purpose: personal bookkeeping.
- Storage: only on the owner's own computer.
- Sharing: no data is shared with third parties.
- Warranty: none.
@lundha
lundha / selectForUpdate.go
Created November 2, 2023 08:41
SELECT ... FOR UPDATE
package main
import (
"context"
"database/sql"
"fmt"
"log"
"sort"
"github.com/jmoiron/sqlx"
@lundha
lundha / gist:d592bd11f1c490999e3bcdb272e114bc
Last active October 17, 2023 18:34
Gorm v2.0 cleanup hook
func DeleteCreatedEntities(db *gorm.DB) func() {
hookName := "cleanupHook"
type entity struct {
table string
key string
value interface{}
}
var entries []entity