Example #1
0
        internal QueryBuilder(IWrapper <TWrapper> command, Func <object> commandResultAccessor, RowGroup rowGroup)
        {
            Check.IsNotNull(command, nameof(command));
            Check.IsNotNull(commandResultAccessor, nameof(commandResultAccessor));
            Check.IsNotNull(rowGroup, nameof(rowGroup));

            this.command = command;
            this.commandResultAccessor = commandResultAccessor;
            this.rowGroup = rowGroup;
        }
        public QueryBuilder <TWrapper> Query <TWrapper>(Func <TDb, IWrapper <TWrapper> > commandFactory)
            where TWrapper : PostgresQueryCommand, IWrapper <SelectClause>
        {
            Check.IsNotNull(commandFactory, nameof(commandFactory));

            var command = commandFactory(db);

            commands.Add(command);

            var index       = commands.Count - 1;
            var queryResult = new RowGroup(index.ToString(), Enumerable.Empty <string>(), true);

            queryResults.Add(x => queryResult.Apply(x));

            return(new QueryBuilder <TWrapper>(command, () => result?[index], queryResult));
        }
Example #3
0
 public void AddChild(RowGroup rowGroup)
 {
     children.Add(rowGroup);
 }