Exemplo n.º 1
0
        private static async Task <object> ToSimpleObject(IBifoqlMapInternal lookup)
        {
            var values = new Dictionary <string, object>();

            foreach (var pair in lookup)
            {
                var value = await pair.Value();

                if (value is IBifoqlUndefined || value is IBifoqlLookupBase)
                {
                    continue;
                }

                values[pair.Key] = await ToSimpleObject(value);
            }

            return(new DynamicDict(values));
        }
Exemplo n.º 2
0
        public static Task <IBifoqlObject> Values(Location location, QueryContext context, IBifoqlMapInternal map)
        {
            var values = new List <Func <Task <IBifoqlObject> > >();

            foreach (var pair in map)
            {
                values.Add(pair.Value);
            }

            return(Task.FromResult <IBifoqlObject>(new AsyncArray(values)));
        }
Exemplo n.º 3
0
        public static Task <IBifoqlObject> Unzip(Location location, QueryContext context, IBifoqlMapInternal map)
        {
            var keys   = new List <Func <Task <IBifoqlObject> > >();
            var values = new List <Func <Task <IBifoqlObject> > >();

            foreach (var pair in map)
            {
                keys.Add(() => Task.FromResult((IBifoqlObject) new AsyncString(pair.Key)));
                values.Add(pair.Value);
            }

            var resultDict = new List <Func <Task <IBifoqlObject> > >
            {
                () => Task.FromResult((IBifoqlObject) new AsyncArray(keys)),
                () => Task.FromResult((IBifoqlObject) new AsyncArray(values))
            };

            return(Task.FromResult <IBifoqlObject>(new AsyncArray(resultDict)));
        }
Exemplo n.º 4
0
        public static Task <IBifoqlObject> Keys(Location location, QueryContext context, IBifoqlMapInternal map)
        {
            var keys = new List <Func <Task <IBifoqlObject> > >();

            foreach (var pair in map)
            {
                keys.Add(() => Task.FromResult((IBifoqlObject) new AsyncString(pair.Key)));
            }

            return(Task.FromResult <IBifoqlObject>(new AsyncArray(keys)));
        }