Merged in feature/splitqueryrunning (pull request #57)

Split Query Running + Debugging Full Flow

* completedquerysyncrunner

* spliitinglogic

* synccomplete

* informdependents

* only push same collector

* deps

* livetesting

* foundissue

* some issues resolved

* activeupdate

* collectorupdatefixes

* fix dbquesries

* tests

* tests

* pollingdebug
This commit is contained in:
Michael McGuinness
2025-02-11 15:22:59 +00:00
parent 24a038ec3d
commit 71f9802e1a
108 changed files with 3013 additions and 1666 deletions
+58 -1
View File
@@ -1,6 +1,10 @@
package validation
import "fmt"
import (
"errors"
"fmt"
"reflect"
)
func GetUpdatedValue[T any](def T, new *T) T {
if new != nil {
@@ -39,3 +43,56 @@ func NormalizeInClosedInterval(updated **int32, current int32, min int32, max in
return nil
}
func AreAllPointersNilExcept[T any](s T, exceptions ...string) bool {
v := reflect.ValueOf(s)
if v.Kind() == reflect.Ptr {
v = v.Elem()
}
if v.Kind() != reflect.Struct {
return false
}
exceptFields := make(map[string]bool)
for _, name := range exceptions {
exceptFields[name] = true
}
t := v.Type()
for i := 0; i < v.NumField(); i++ {
field := v.Field(i)
fieldName := t.Field(i).Name
if exceptFields[fieldName] || field.Kind() != reflect.Ptr {
continue
}
if !field.IsNil() {
return false
}
}
return true
}
func GetFieldName[T any](s T, field any) (string, error) {
v := reflect.ValueOf(s)
if v.Kind() == reflect.Ptr {
v = v.Elem()
}
t := v.Type()
fieldValue := reflect.ValueOf(field)
for i := 0; i < v.NumField(); i++ {
f := v.Field(i)
if f.Kind() == reflect.Ptr && f.Pointer() == fieldValue.Pointer() ||
f.Kind() != reflect.Ptr && f.CanAddr() && f.Addr().Pointer() == fieldValue.Pointer() {
return t.Field(i).Name, nil
}
}
return "", errors.New("field not found")
}