iterator interface chenged index and count members from int to tint 64

This commit is contained in:
2026-05-01 17:15:18 +02:00
parent 75ed88915d
commit dacbec677a
13 changed files with 65 additions and 44 deletions
+2 -2
View File
@@ -30,8 +30,8 @@ type Iterator interface {
fmt.Stringer
Next() (item any, err error) // must return io.EOF after the last item
Current() (item any, err error)
Index() int
Count() int
Index() int64
Count() int64
HasOperation(name string) bool
CallOperation(name string, args map[string]any) (value any, err error)
}
+11
View File
@@ -75,3 +75,14 @@ func ToGoInt(value any, description string) (i int, err error) {
}
return
}
func ToGoInt64(value any, description string) (i int64, err error) {
if valueInt64, ok := value.(int64); ok {
i = valueInt64
} else if valueInt, ok := value.(int); ok {
i = int64(valueInt)
} else {
err = fmt.Errorf("%s expected integer, got %s (%v)", description, TypeName(value), value)
}
return
}