public static IEnumerable <SearchItem> Print(SearchExpressionContext c) { var skipCount = 0; if (SearchExpression.GetFormatString(c.args[0], out var formatStr)) { skipCount++; } var outputValueFieldName = System.Guid.NewGuid().ToString("N"); foreach (var expr in c.args.Skip(skipCount)) { if (expr == null) { yield return(null); continue; } var str = new List <string>(); var dataSet = SearchExpression.ProcessValues(expr.Execute(c), outputValueFieldName, item => { var valueStr = SearchExpression.FormatItem(c.search, item, formatStr); str.Add(valueStr); return(valueStr); }); foreach (var item in dataSet) { yield return(item); } Debug.Log($"[{string.Join(",", str)}]"); } }
public static IEnumerable <SearchItem> Format(SearchExpressionContext c) { var skipCount = 0; if (SearchExpression.GetFormatString(c.args[0], out var formatStr)) { skipCount++; } var items = c.args.Skip(skipCount).SelectMany(e => e.Execute(c)); var dataSet = SearchExpression.ProcessValues(items, null, item => SearchExpression.FormatItem(c.search, item, formatStr)); return(dataSet); }
public static IEnumerable <SearchItem> SelectValues(SearchContext context, IEnumerable <SearchItem> items, string selector, string setFieldName) { return(SearchExpression.ProcessValues(items, setFieldName, item => SelectValue(item, context, selector)?.ToString())); }