public IDataMutation CreateMutate(string name, IQuery query, Func <IObservable <TData>, IObservable <TData?> > transform, IObserver <Unit>?onCompled = null)
        {
            async Task Runner()
            {
                var sender = new Subject <TData>();

                _responder.Push(query, transform(sender).NotNull(), onCompled);

                var data = await _dataSource.GetData(query);

                sender.OnNext(data);
                sender.OnCompleted();
            }

            return(new AsyncDataMutation <TData>(Runner, name, query.ToHash()));
        }
Beispiel #2
0
        public IDataMutation CreateMutate(string name, Func <Maybe <TData>, Maybe <TData> > transform, Maybe <object> hash = default)
        {
            void Runner() => _responder.Push(transform(_dataSource.GetData()));

            return(new DataMutation(Runner, name, hash));
        }
Beispiel #3
0
        public IDataMutation CreateMutate(string name, IQuery query, Func <Maybe <TData>, Maybe <TData> > transform)
        {
            async Task Runner() => await _responder.Push(query, async() => transform(await _dataSource.GetData(query)));

            return(new AsyncDataMutation(Runner, name, query.ToHash().Cast <string, object>()));
        }