From 77fa207eb50319a5ab4be4baf644236a2fe487ae Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 11 Oct 2021 18:12:12 +0200 Subject: [PATCH] cmd/ido2icingadb: simplify unnecessarily complex datatype --- cmd/ido2icingadb/cache.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/ido2icingadb/cache.go b/cmd/ido2icingadb/cache.go index b4e9bff9..abdd9792 100644 --- a/cmd/ido2icingadb/cache.go +++ b/cmd/ido2icingadb/cache.go @@ -152,15 +152,15 @@ func buildPreviousHardStateCache(ht *historyType, idoColumns []string) { } cacheGet(*tx, &nextIds, "SELECT COUNT(*) cnt, MIN(history_id) min_id FROM next_ids") - var previousHardState struct{ Cnt int64 } - cacheGet(*tx, &previousHardState, "SELECT COUNT(*) cnt FROM previous_hard_state") + var previousHardStateCnt int64 + cacheGet(*tx, &previousHardStateCnt, "SELECT COUNT(*) FROM previous_hard_state") var checkpoint int64 if nextIds.MinId.Valid { // there are next_ids checkpoint = nextIds.MinId.Int64 // this kind of caches is filled descending } else { // there aren't any next_ids // next_ids contains the most recently processed IDs and is only empty if... - if previousHardState.Cnt == 0 { + if previousHardStateCnt == 0 { // ... we didn't actually start yet... checkpoint = math.MaxInt64 // start from the largest (possible) ID } else { @@ -169,7 +169,7 @@ func buildPreviousHardStateCache(ht *historyType, idoColumns []string) { } } - ht.bar.SetCurrent(previousHardState.Cnt + nextIds.Cnt) + ht.bar.SetCurrent(previousHardStateCnt + nextIds.Cnt) inc := barIncrementer{ht.bar, time.Now()} // We continue where we finished before. As we build the cache in reverse chronological order: