public void FromEnumerable_Normal() { IEnumerable <int> en = new List <int>(new int[] { 1, 2, 3, 4, 5 }); Flux.From(en) .Test().AssertResult(1, 2, 3, 4, 5); }
public void FlattenEnumerable_Normal() { Flux.From( new List <int>(new[] { 1, 2, 3 }), new List <int>(), new List <int>(new[] { 5 }), new List <int>(new[] { 6, 7 }) ).ConcatMap(v => v) .Test() .AssertResult(1, 2, 3, 5, 6, 7); }
public void Parallel_Sorted() { for (int i = 1; i <= 32; i++) { Flux.From(10, 9, 8, 7, 6, 5, 4, 3, 2, 1) .Parallel(i) .Sorted() .Test() .AssertResult(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); } }
public async Task <Book[]> GetBooksAsync() { var flux = Flux .From(defaultBucket) .Range("-3d") .Filter(FnBody.R.MeasurementEquals($"{nameof(Book)}")) .Pivot() .Sort(Columns.Time, desc: true) .Limit(10) ; return(await infuxdb.QueryAsync <Book>(flux)); }
public async Task <List <Book> > GetBooksAsync() { // 这里借用Influxdb2.Client的Flux对象辅助生成查询字符串 var flux = Flux .From(options.DefaultBucket) .Range("-3d") .Filter(FnBody.R.MeasurementEquals($"{nameof(Book)}")) .Pivot() .Sort(Columns.Time, desc: true) .Limit(10) ; var api = this.infuxdb.GetQueryApi(); return(await api.QueryAsync <Book>(flux.ToString(), options.DefaultOrg)); }
public void FlattenEnumerable_Normal_Backpressure() { var ts = Flux.From( new List <int>(new[] { 1, 2, 3 }), new List <int>(), new List <int>(new[] { 5 }), new List <int>(new[] { 6, 7 }) ).ConcatMap(v => v) .Test(0); ts.AssertNoValues(); ts.Request(2); ts.AssertValues(1, 2); ts.Request(2); ts.AssertValues(1, 2, 3, 5); ts.Request(2); ts.AssertResult(1, 2, 3, 5, 6, 7); }
public void SubscribeOn_Callable() { Flux.From(() => 1).SubscribeOn(DefaultScheduler.Instance) .Test().AwaitTerminalEvent() .AssertResult(1); }
/// <summary> /// Finds the specified specification. /// </summary> /// <param name="specification">The specification.</param> /// <returns>The flux of entities.</returns> public IFlux <T> Query(Specification <T> specification) { return(Flux.From <T>(this.set.Entity <T>().Where(specification.Spec))); }
/// <summary> /// Query this instance. /// </summary> /// <returns>The flux of type T.</returns> public IFlux <T> Query() { return(Flux.From <T>(this.set.Entity <T>())); }
public void Concat_Infinite() { Flux.From(Infinite()).ConcatWith(Flux.Empty <int>()) .Take(10) .Test().AssertValueCount(10); }
/// <summary> /// Query this instance. /// </summary> /// <returns>The flux of type T.</returns> public IFlux <T> Query() => Flux.From <T>(this.set.Entity <T>());
public override IPublisher <int> CreatePublisher(long elements) => Flux.From(Enumerate(elements / 2)).ConcatWith(Flux.From(Enumerate((elements + 1) / 2))).Tck();