Exemplo n.º 1
0
Arquivo: Api.cs Projeto: 4vz/Aveezo
    protected Result <T[]> Query <T>(SqlSelect select, Action <ApiQueryOptions <T> > options, Func <SqlRow, T> create)
    {
        if (select == null)
        {
            return(NotFound());
        }

        var opt = new ApiQueryOptions <T>();

        options?.Invoke(opt);

        Values <string> fields        = null;
        List <string>   displayFields = null;

        if (create != null)
        {
        }
        else
        {
            var idBuilderStack = select.GetBuilderStack(Sql.Id);

            if (idBuilderStack == null)
            {
                return(Unavailable($"Builder with the identifier key ({Sql.Id}) is not found in the current builders. Please review the select function for this method."));
            }

            fields        = Parameters.Fields;
            displayFields = new();

            if (Parameters.Queries != null && Parameters.Queries.Length > 0)
            {
                Dictionary <string, (SqlQueryType, string)[]> queries = new();