Ejemplo n.º 1
0
 public static IKeyedStream <TIn, TKey> Distinct <TIn, TKey>(this ISortedStream <TIn, TKey> stream, string name)
 {
     return(new DistinctSortedStreamNode <TIn, TKey>(name, new DistinctSortedArgs <TIn, TKey>
     {
         InputStream = stream
     }).Output);
 }
Ejemplo n.º 2
0
 public static ISortedStream <TIn, TKey> DoAndResolve <TIn, TKey>(this ISortedStream <TIn, TKey> stream, string name, Func <DoWithResolutionProcessorBuilder <TIn, TIn>, IDoProcessor <TIn> > o)
 {
     return(new DoStreamNode <TIn, ISortedStream <TIn, TKey> >(name, new DoArgs <TIn, ISortedStream <TIn, TKey> >
     {
         Processor = o(new DoWithResolutionProcessorBuilder <TIn, TIn>(i => i)),
         Stream = stream
     }).Output);
 }
Ejemplo n.º 3
0
 public static ISortedStream <TIn, TKey> ToAction <TIn, TKey>(this ISortedStream <TIn, TKey> stream, string name, Action <TIn> processRow)
 {
     return(new ToActionStreamNode <TIn, ISortedStream <TIn, TKey> >(name, new ToActionArgs <TIn, ISortedStream <TIn, TKey> >
     {
         ProcessRow = processRow,
         Stream = stream
     }).Output);
 }
Ejemplo n.º 4
0
 public static ISortedStream <TIn, TKey> Where <TIn, TKey>(this ISortedStream <TIn, TKey> stream, string name, Func <TIn, bool> predicate)
 {
     return(new WhereStreamNode <TIn, ISortedStream <TIn, TKey> >(name, new WhereArgs <TIn, ISortedStream <TIn, TKey> >
     {
         Input = stream,
         Predicate = predicate
     }).Output);
 }
Ejemplo n.º 5
0
 public static ISortedStream <TIn, TKey> Top <TIn, TKey>(this ISortedStream <TIn, TKey> stream, string name, int count)
 {
     return(new TopStreamNode <TIn, ISortedStream <TIn, TKey> >(name, new TopArgs <TIn, ISortedStream <TIn, TKey> >
     {
         Input = stream,
         Count = count
     }).Output);
 }
Ejemplo n.º 6
0
 public static IStream <Correlated <TOut> > GroupBy <TIn, TKey, TOut>(this ISortedStream <Correlated <TIn>, TKey> stream, string name, Func <IStream <Correlated <TIn> >, TIn, IStream <Correlated <TOut> > > subProcess)
 {
     return(new GroupByCorrelatedSortedStreamNode <TIn, TKey, TOut>(name, new GroupByCorrelatedSortedArgs <TIn, TKey, TOut>
     {
         SubProcess = subProcess,
         Stream = stream
     }).Output);
 }
Ejemplo n.º 7
0
 public static ISortedStream <Correlated <TIn>, TKey> Where <TIn, TKey>(this ISortedStream <Correlated <TIn>, TKey> stream, string name, Func <TIn, bool> predicate)
 {
     return(new WhereStreamNode <Correlated <TIn>, ISortedStream <Correlated <TIn>, TKey> >(name, new WhereArgs <Correlated <TIn>, ISortedStream <Correlated <TIn>, TKey> >
     {
         Input = stream,
         Predicate = i => predicate(i.Row)
     }).Output);
 }
Ejemplo n.º 8
0
 public static ISortedStream <TIn, TKey> Do <TIn, TKey>(this ISortedStream <TIn, TKey> stream, string name, IDoProcessor <TIn> processor)
 {
     return(new DoStreamNode <TIn, ISortedStream <TIn, TKey> >(name, new DoArgs <TIn, ISortedStream <TIn, TKey> >
     {
         Processor = processor,
         Stream = stream
     }).Output);
 }
Ejemplo n.º 9
0
 public static ISortedStream <TIn, TKey> Do <TIn, TKey>(this ISortedStream <TIn, TKey> stream, string name, Action <TIn> processRow)
 {
     return(new DoStreamNode <TIn, ISortedStream <TIn, TKey> >(name, new DoArgs <TIn, ISortedStream <TIn, TKey> >
     {
         Processor = new SimpleDoProcessor <TIn, TIn>(i => i, processRow),
         Stream = stream
     }).Output);
 }
Ejemplo n.º 10
0
 public static ISortedStream <TIn, TKey> ToExcelFile <TIn, TKey>(this ISortedStream <TIn, TKey> stream, string name, IStream <Stream> resourceStream)
 {
     return(new ToExcelFileStreamNode <TIn, ISortedStream <TIn, TKey> >(name, new ToExcelFileArgs <TIn, ISortedStream <TIn, TKey> >
     {
         MainStream = stream,
         TargetStream = resourceStream
     }).Output);
 }
Ejemplo n.º 11
0
 public static ISortedStream<TIn, TKey> ThroughAction<TIn, TKey>(this ISortedStream<TIn, TKey> stream, string name, IThroughActionProcessor<TIn> processor)
 {
     return new ThroughActionStreamNode<TIn, ISortedStream<TIn, TKey>>(name, new ThroughActionArgs<TIn, ISortedStream<TIn, TKey>>
     {
         Processor = processor,
         Stream = stream
     }).Output;
 }
Ejemplo n.º 12
0
 public static ISortedStream<TIn, TKey> ThroughAction<TIn, TKey, TCtx>(this ISortedStream<TIn, TKey> stream, string name, TCtx initialContext, Action<TIn, TCtx, Action<TCtx>> processRow)
 {
     return new ThroughActionStreamNode<TIn, ISortedStream<TIn, TKey>>(name, new ThroughActionArgs<TIn, ISortedStream<TIn, TKey>>
     {
         Processor = new ContextThroughActionProcessor<TIn, TCtx>(processRow, initialContext),
         Stream = stream
     }).Output;
 }
Ejemplo n.º 13
0
 public static IStream <TInLeft> Substract <TInLeft, TInRight, TKey>(this ISortedStream <TInLeft, TKey> leftStream, string name, ISortedStream <TInRight, TKey> rightStream)
 {
     return(new SubstractStreamNode <TInLeft, TInRight, TKey>(name, new SubstractArgs <TInLeft, TInRight, TKey>
     {
         LeftInputStream = leftStream,
         RightInputStream = rightStream,
     }).Output);
 }
Ejemplo n.º 14
0
 public static ISortedStream<TIn, TKey> ThroughAction<TIn, TResource, TKey>(this ISortedStream<TIn, TKey> stream, string name, ISingleStream<TResource> resourceStream, Action<TIn, TResource> processRow, Action<TResource> preProcess = null)
 {
     return new ThroughActionStreamNode<TIn, ISortedStream<TIn, TKey>, TResource>(name, new ThroughActionArgs<TIn, ISortedStream<TIn, TKey>, TResource>
     {
         Stream = stream,
         ResourceStream = resourceStream,
         Processor = new SimpleThroughActionProcessor<TIn, TResource>(processRow, preProcess)
     }).Output;
 }
Ejemplo n.º 15
0
 public static ISortedStream<TIn, TKey> ThroughAction<TIn, TResource, TKey>(this ISortedStream<TIn, TKey> stream, string name, ISingleStream<TResource> resourceStream, IThroughActionProcessor<TIn, TResource> processor)
 {
     return new ThroughActionStreamNode<TIn, ISortedStream<TIn, TKey>, TResource>(name, new ThroughActionArgs<TIn, ISortedStream<TIn, TKey>, TResource>
     {
         Stream = stream,
         ResourceStream = resourceStream,
         Processor = processor
     }).Output;
 }
Ejemplo n.º 16
0
 public static ISortedStream <TIn, TKey> ToExcelFile <TIn, TKey>(this ISortedStream <TIn, TKey> stream, string name, ISingleStream <Stream> resourceStream, ExcelFileDefinition <TIn> mapping = null)
 {
     return(new ToExcelFileStreamNode <TIn, ISortedStream <TIn, TKey> >(name, new ToExcelFileArgs <TIn, ISortedStream <TIn, TKey> >
     {
         MainStream = stream,
         TargetStream = resourceStream,
         Mapping = mapping
     }).Output);
 }
Ejemplo n.º 17
0
 public static ISortedStream <TIn, TKey> ToTextFile <TIn, TKey>(this ISortedStream <TIn, TKey> stream, string name, IStream <SystemIO.StreamWriter> resourceStream, FlatFileDefinition <TIn> mapping) where TIn : new()
 {
     return(new ToFlatFileStreamNode <TIn, ISortedStream <TIn, TKey> >(name, new ToFlatFileArgs <TIn, ISortedStream <TIn, TKey> >
     {
         MainStream = stream,
         Mapping = mapping,
         TargetStream = resourceStream
     }).Output);
 }
Ejemplo n.º 18
0
 public static ISortedStream <TIn, TKey> ThroughTextFile <TIn, TKey>(this ISortedStream <TIn, TKey> stream, string name, ISingleStream <SystemIO.Stream> resourceStream, FlatFileDefinition <TIn> mapping)
 {
     return(new ThroughFlatFileStreamNode <TIn, ISortedStream <TIn, TKey> >(name, new ThroughFlatFileArgs <TIn, ISortedStream <TIn, TKey> >
     {
         MainStream = stream,
         Mapping = mapping,
         TargetStream = resourceStream
     }).Output);
 }
Ejemplo n.º 19
0
 public static IStream <TOut> LeftJoin <TInLeft, TInRight, TOut, TKey>(this ISortedStream <TInLeft, TKey> leftStream, string name, IKeyedStream <TInRight, TKey> rightStream, Func <TInLeft, TInRight, TOut> resultSelector)
 {
     return(new JoinStreamNode <TInLeft, TInRight, TOut, TKey>(name, new JoinArgs <TInLeft, TInRight, TOut, TKey>
     {
         LeftInputStream = leftStream,
         RightInputStream = rightStream,
         ResultSelector = resultSelector,
         RedirectErrorsInsteadOfFail = false
     }).Output);
 }
Ejemplo n.º 20
0
 public static ISortedStream <TIn, TKey> ToAction <TIn, TResource, TKey>(this ISortedStream <TIn, TKey> stream, string name, IStream <TResource> resourceStream, Action <TIn, TResource> processRow, Action <TResource> preProcess = null)
 {
     return(new ToActionStreamNode <TIn, ISortedStream <TIn, TKey>, TResource>(name, new ToActionArgs <TIn, ISortedStream <TIn, TKey>, TResource>
     {
         ProcessRow = processRow,
         Stream = stream,
         ResourceStream = resourceStream,
         PreProcess = preProcess
     }).Output);
 }
Ejemplo n.º 21
0
 public static ISortedStream <TIn, TKey> WaitWhenDone <TIn, TKey>(this ISortedStream <TIn, TKey> stream, string name, params IStream <object>[] streamToWait)
 {
     return(new WaitWhenDoneStreamNode <TIn, ISortedStream <TIn, TKey> >(name, new WaitWhenDoneArgs <TIn, ISortedStream <TIn, TKey> >
     {
         Input = stream,
         Input1ToWait = streamToWait.Length >= 1 ? streamToWait[0] : null,
         Input2ToWait = streamToWait.Length >= 2 ? streamToWait[1] : null,
         Input3ToWait = streamToWait.Length >= 3 ? streamToWait[2] : null,
         Input4ToWait = streamToWait.Length >= 4 ? streamToWait[3] : null,
         Input5ToWait = streamToWait.Length >= 5 ? streamToWait[4] : null,
         Input6ToWait = streamToWait.Length >= 6 ? streamToWait[5] : null,
         Input7ToWait = streamToWait.Length >= 7 ? streamToWait[6] : null,
         Input8ToWait = streamToWait.Length >= 8 ? streamToWait[7] : null,
         Input9ToWait = streamToWait.Length >= 9 ? streamToWait[8] : null,
         Input10ToWait = streamToWait.Length >= 10 ? streamToWait[9] : null,
     }).Output);
 }
Ejemplo n.º 22
0
 public static IKeyedStream <TIn, TGroupingKey> Distinct <TIn, TGroupingKey>(this ISortedStream <TIn, TGroupingKey> stream, string name, bool tryToExcludeNullValues = false)
 {
     if (tryToExcludeNullValues)
     {
         return(new SmartDistinctSortedStreamNode <TIn, TGroupingKey>(name, new SmartDistinctSortedArgs <TIn, TGroupingKey>
         {
             InputStream = stream
         }).Output);
     }
     else
     {
         return(new DistinctSortedStreamNode <TIn, TGroupingKey>(name, new DistinctSortedArgs <TIn, TGroupingKey>
         {
             InputStream = stream
         }).Output);
     }
 }
Ejemplo n.º 23
0
 public static ISortedStream <Correlated <AggregationResult <TIn, TKey, List <TIn> > >, TKey> GroupBy <TIn, TKey>(this ISortedStream <Correlated <TIn>, TKey> stream, string name)
 {
     return(new AggregateCorrelatedSortedStreamNode <TIn, List <TIn>, TKey>(name, new AggregateCorrelatedSortedArgs <TIn, List <TIn>, TKey>
     {
         InputStream = stream,
         Aggregate = (a, v) => { a.Add(v); return a; },
         CreateEmptyAggregation = _ => new List <TIn>(),
     }).Output);
 }
Ejemplo n.º 24
0
 public static ISortedStream <TIn, TKey> ToEntityFrameworkCore <TIn, TRes, TKey>(this ISortedStream <TIn, TKey> stream, string name, IStream <TRes> resourceStream, BulkLoadMode bulkLoadMode = BulkLoadMode.InsertOnly, int chunkSize = 1000)
     where TRes : DbContext
     where TIn : class
 {
     return(new ToEntityFrameworkCoreStreamNode <TIn, TRes, ISortedStream <TIn, TKey> >(name, new ToEntityFrameworkCoreArgs <TIn, TRes, ISortedStream <TIn, TKey> >
     {
         SourceStream = stream,
         DbContextStream = resourceStream,
         BatchSize = chunkSize,
         BulkLoadMode = bulkLoadMode
     }).Output);
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Aggregate every element of a sorted stream into a list of aggregations computed for each group by the sorting key
 /// </summary>
 /// <param name="stream">Sorted input stream</param>
 /// <param name="name">Name of the operation</param>
 /// <param name="emptyAggregation">Initial value of the aggregation per key</param>
 /// <param name="aggregate">Aggregator that will receive the current value of the aggregation for the key value of the current element and that must return the new aggregation value</param>
 /// <typeparam name="TIn">Main stream type</typeparam>
 /// <typeparam name="TAggr">Aggregation type</typeparam>
 /// <typeparam name="TKey">Key type</typeparam>
 /// <returns>Output type</returns>
 public static ISortedStream <AggregationResult <TIn, TKey, TAggr>, TKey> Aggregate <TIn, TAggr, TKey>(this ISortedStream <TIn, TKey> stream, string name, Func <TIn, TAggr> emptyAggregation, Func <TAggr, TIn, TAggr> aggregate)
 {
     return(new AggregateSortedStreamNode <TIn, TAggr, TKey>(name, new AggregateSortedArgs <TIn, TAggr, TKey>
     {
         InputStream = stream,
         Aggregate = aggregate,
         CreateEmptyAggregation = emptyAggregation
     }).Output);
 }
Ejemplo n.º 26
0
 public static ISortedStream <AggregationResult <TIn, TKey, TAggr>, TKey> Pivot <TIn, TAggr, TKey>(this ISortedStream <TIn, TKey> stream, string name, Expression <Func <TIn, TAggr> > aggregationDescriptor)
 {
     return(new PivotSortedStreamNode <TIn, TAggr, TKey>(name, new PivotSortedArgs <TIn, TAggr, TKey>
     {
         InputStream = stream,
         AggregationDescriptor = aggregationDescriptor
     }).Output);
 }