Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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;
 }
Пример #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;
 }
Пример #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);
 }
Пример #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;
 }
Пример #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;
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
     }
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }