/// <summary> /// Search the database for songs matching expression (case-INsensitive) /// </summary> public async Task <Responses.SongInfoCollection> Search(Tags tag, FilterMatch match, string search) { string exp = Commands.Find.ExpressionBuilder(tag, match, search); var resp = await ExecuteCommandAsync(new Commands.Search(exp)); return((Responses.SongInfoCollection)resp); }
internal ReflectedMember(INamedTypeSymbol reflectedType, ExpressionSyntax typeSource, ISymbol symbol, IMethodSymbol getX, InvocationExpressionSyntax invocation, FilterMatch match) { this.ReflectedType = reflectedType; this.TypeSource = typeSource; this.Symbol = symbol; this.GetX = getX; this.Invocation = invocation; this.Match = match; }
/// <summary> /// Builds an filter Expression /// </summary> public static string ExpressionBuilder(Tags tag, FilterMatch match, string search) { string strMatch = match switch { FilterMatch.Equals => "==", FilterMatch.Different => "!=", FilterMatch.Contains => "contains", _ => throw new ArgumentException("Invalid FilterMatch"), }; string scapedSearch = Helper.EscapingHelper.Escape(search); return($"{tag} {strMatch} \"{scapedSearch}\""); }