From 53e23bb52a1e82a0060c7bd12ed1e8da8242c401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Sat, 14 Sep 2024 18:07:00 -0400 Subject: [PATCH] add `Get` method to model registry --- registry.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/registry.go b/registry.go index 6c81e2c..ca59a53 100644 --- a/registry.go +++ b/registry.go @@ -234,6 +234,14 @@ func (r TModelRegistry) new_(n string) interface{} { return nil } +func (r TModelRegistry) Get(name string) *Model { + model, ok := r[name] + if !ok { + return nil + } + return model +} + // Model registers models in the ModelRegistry, where // they can be accessed via a model's struct name func (r TModelRegistry) Model(mdl ...any) {