Explorar el Código

Add BingenStream to the codecs such that streams can be typed under the interface

Matt Bolt hace 1 mes
padre
commit
c4916b5993
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  1. 10 0
      core/pkg/opencost/opencost_codecs.go

+ 10 - 0
core/pkg/opencost/opencost_codecs.go

@@ -165,6 +165,16 @@ func resolveType(t string) (pkg string, name string, isPtr bool) {
 //  Stream Helpers
 //--------------------------------------------------------------------------
 
+// BingenStream is the stream interface for all streamable types
+type BingenStream interface {
+	// Stream returns the iterator which will stream each field of the target type and
+	// return the field info as well as the value.
+	Stream() iter.Seq2[BingenFieldInfo, *BingenValue]
+
+	// Close will close any dynamic io.Readers used to stream in the fields
+	Close()
+}
+
 // BingenValue contains the value of a field as well as any index/key associated with that value.
 type BingenValue struct {
 	Value any