From a72897655b8437e6ce77ebc935b5e4de29cc545d Mon Sep 17 00:00:00 2001 From: Pieter Hollander Date: Tue, 20 Feb 2024 16:52:09 +0100 Subject: [PATCH] Add comment to updateFieldIfChanged. --- main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/main.go b/main.go index 4572f68..e9d90bd 100644 --- a/main.go +++ b/main.go @@ -148,6 +148,7 @@ func createLoggerWithLevel(level slog.Level) *slog.Logger { })) } +// updateFieldIfChanged ensures that meter readings that haven't been updated aren't written to the database, in order to save storage space. func updateFieldIfChanged(currentValue *int, previousValue *int) (*int, bool) { if currentValue != nil && *currentValue == *previousValue { return nil, false // No change