work related to autogenpb IterBy() functions
This commit is contained in:
parent
dba126cfdf
commit
88d25c85c2
|
@ -2,6 +2,7 @@ package gitpb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"iter"
|
||||||
|
|
||||||
"github.com/go-cmd/cmd"
|
"github.com/go-cmd/cmd"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -91,3 +92,46 @@ func (r *Repo) MergeToMaster() (*cmd.Status, error) {
|
||||||
r.Reload() // rescan the repo
|
r.Reload() // rescan the repo
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
func (x *Repos) All2() iter.Seq[*Repo] {
|
||||||
|
repoMu.RLock()
|
||||||
|
defer repoMu.RUnlock()
|
||||||
|
|
||||||
|
// Create a new slice to hold pointers to each Repo
|
||||||
|
var tmp []*Repo
|
||||||
|
tmp = make([]*Repo, len(x.Repos))
|
||||||
|
for i, p := range x.Repos {
|
||||||
|
tmp[i] = p // Copy pointers for safe iteration
|
||||||
|
}
|
||||||
|
|
||||||
|
// return x.Repos
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
func (x *Repos) IterAll() iter.Seq[*Repo] {
|
||||||
|
items := x.selectAllRepos()
|
||||||
|
return func(yield func(*Repo) bool) {
|
||||||
|
for _, v := range items {
|
||||||
|
if !yield(v) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
func (x *Repos) IterByFullPath() iter.Seq[*Repo] {
|
||||||
|
items := x.selectAllRepos()
|
||||||
|
sort.Sort(RepoFullPath(items))
|
||||||
|
log.Info("MAKING Iter.Seq[] with length", len(items))
|
||||||
|
return func(yield func(*Repo) bool) {
|
||||||
|
for _, v := range items {
|
||||||
|
if !yield(v) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
Loading…
Reference in New Issue