summaryrefslogtreecommitdiff
path: root/find.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-09 20:01:19 -0500
committerJeff Carr <[email protected]>2025-10-09 20:06:43 -0500
commiteb947f9b20ab26f3a264512d9ea876c503eb0ec1 (patch)
tree4c4159a3c54e4e7b1257d874019016ca6f87aeac /find.go
parent5abcfec4a234a3b4d8f60fa56d85152c06c43da2 (diff)
make /home/mirrors/debian/distsv0.0.82
Diffstat (limited to 'find.go')
-rw-r--r--find.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/find.go b/find.go
new file mode 100644
index 0000000..6f876c0
--- /dev/null
+++ b/find.go
@@ -0,0 +1,25 @@
+package zoopb
+
+import (
+ "errors"
+)
+
+func (m *Machine) FindByPackageName(name string) (*Package, error) {
+ return m.Packages.FindByPackageName(name)
+}
+
+// used when you want to inforce the protobuf only has one package per name
+func (all *Packages) FindByPackageName(name string) (*Package, error) {
+ var found *Package
+ for p := range all.IterByPackage() {
+ if name == p.Package {
+ if found != nil {
+ return found, errors.New("duplicate package names in protobuf")
+ }
+ found = p
+ }
+ }
+
+ // log.Info("package name not found", name)
+ return found, nil
+}