fix build: Add IBlueRowFactory, and HasChanges ext
The recently added MongoCollectionStream dependend on these items. It has been a while since I've looked at this branch, so I'm not sure what happened, but the referenced members were no where to be found.
This commit is contained in:
1 parent
c80374579e
commit
6eaacdbf17
4 files changed
+30
-2
No files matched your search
@@ -9,7 +9,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class BlueTableSchemaAdaptor<T> {
|
||||
public class BlueTableSchemaAdaptor<T> : IMutableBlueRowFactory<T> {
|
||||
readonly string name;
|
||||
readonly List<ColumnAdaptor> columns = [];
|
||||
BlueTableSchema? schema;
|
||||
@@ -60,7 +60,10 @@ public class BlueTableSchemaAdaptor<T> {
|
||||
columns.Add(new ColumnAdaptor(new(name, columns.Count, dataType), r => getValue(r)));
|
||||
}
|
||||
|
||||
public IBlueRow GetBlueRow(T item) {
|
||||
public IBlueRow GetBlueRow(T item) =>
|
||||
GetMutableBlueRow(item);
|
||||
|
||||
public MutableBlueRow GetMutableBlueRow(T item) {
|
||||
var mbr = new MutableBlueRow(Schema);
|
||||
foreach (var col in columns) {
|
||||
mbr.setValue(col.Info.colNo, col.GetValue(item));
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#nullable enable
|
||||
namespace Bts.DataStream;
|
||||
|
||||
using BCG;
|
||||
|
||||
public interface IBlueRowFactory<T> {
|
||||
IBlueTableSchema Schema { get; }
|
||||
IBlueRow GetBlueRow(T item);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#nullable enable
|
||||
namespace Bts.DataStream;
|
||||
|
||||
using BCG;
|
||||
|
||||
public interface IMutableBlueRowFactory<T> : IBlueRowFactory<T> {
|
||||
MutableBlueRow GetMutableBlueRow(T item);
|
||||
|
||||
IBlueRow IBlueRowFactory<T>.GetBlueRow(T item) =>
|
||||
GetMutableBlueRow(item);
|
||||
}
|
||||
@@ -313,4 +313,9 @@ namespace BCG
|
||||
return String.Format("DataPacket, schema {0} n {1} d {2} a {3}", schema.tableName, newRows.Count, deletedRows.Count, addedRows.Count);
|
||||
}
|
||||
}
|
||||
|
||||
public static class DataPacketExtensions {
|
||||
public static bool HasChanges(this DataPacket dataPacket) =>
|
||||
dataPacket.addedRows.Count > 0 || dataPacket.deletedRows.Count > 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user