From cccac79439448990cc712d2b266d776aa926dde9 Mon Sep 17 00:00:00 2001 From: Dan Jones Date: Sun, 1 Feb 2026 11:29:04 -0600 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20Add=20Get=20method=20to=20Metas?= =?UTF-8?q?=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/meta_test.go | 16 ++++++++++++++++ models/metas.go | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/models/meta_test.go b/models/meta_test.go index 2d4cea8..6fa6141 100644 --- a/models/meta_test.go +++ b/models/meta_test.go @@ -141,3 +141,19 @@ func TestMetasAppendTo(t *testing.T) { assert.Len(t, *ms, 1) assert.Equal(t, Meta{"foo", 42}, (*ms)[0]) } + +func TestMetasGet(t *testing.T) { + ms := Metas{{"foo", 42}, {"bar", "hello"}} + + val, found := ms.Get("foo") + assert.True(t, found) + assert.Equal(t, 42, val) + + val, found = ms.Get("bar") + assert.True(t, found) + assert.Equal(t, "hello", val) + + val, found = ms.Get("baz") + assert.False(t, found) + assert.Nil(t, val) +} diff --git a/models/metas.go b/models/metas.go index 4db9d46..9ed7006 100644 --- a/models/metas.go +++ b/models/metas.go @@ -69,3 +69,13 @@ func (ms *Metas) AppendTo(k string, v any) { n := (*ms).Append(k, v) *ms = n } + +// Returns the value of the Meta with the given key, and a bool indicating if it was found +func (ms Metas) Get(key string) (any, bool) { + for _, m := range ms { + if m.Key == key { + return m.Value, true + } + } + return nil, false +} From ccdbf05e83f9c67650618cb749a85b494657e796 Mon Sep 17 00:00:00 2001 From: Dan Jones Date: Sun, 1 Feb 2026 11:31:31 -0600 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9D=20Update=20CHANGELOG.md=20for?= =?UTF-8?q?=20v0.0.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46990e7..074a24e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [0.0.8] - 2026-02-01 + +- ✨ Add Get method to Metas type + + + ## [0.0.7] - 2025-11-05 - 🚚 Refactor project structure to follow standard Go layout (cmd/my-log/ and internal/cmd/)