Exemplo n.º 1
0
        public static T Count <T>(this Query query, params string[] columns)
        {
            var factory = QueryHelper.CreateQueryFactory(query);

            return(factory.ExecuteScalar <T>(query.AsCount(columns)));
        }
Exemplo n.º 2
0
        public static T Aggregate <T>(this Query query, string aggregateOperation, params string[] columns)
        {
            var factory = QueryHelper.CreateQueryFactory(query);

            return(factory.ExecuteScalar <T>(query.AsAggregate(aggregateOperation, columns)));
        }
Exemplo n.º 3
0
 public static async Task <int> InsertAsync(this Query query, object data)
 {
     return(await QueryHelper.CreateQueryFactory(query)
            .ExecuteAsync(query.AsInsert(data)));
 }
Exemplo n.º 4
0
 public static async Task <IEnumerable <T> > GetAsync <T>(this Query query)
 {
     return(await QueryHelper.CreateQueryFactory(query).GetAsync <T>(query));
 }
Exemplo n.º 5
0
 public static async Task ChunkAsync <T>(this Query query, int chunkSize, Func <IEnumerable <T>, int, bool> func)
 {
     await QueryHelper.CreateQueryFactory(query).ChunkAsync <T>(query, chunkSize, func);
 }
Exemplo n.º 6
0
 public static async Task ChunkAsync <T>(this Query query, int chunkSize, Action <IEnumerable <T>, int> action)
 {
     await QueryHelper.CreateQueryFactory(query).ChunkAsync <T>(query, chunkSize, action);
 }
Exemplo n.º 7
0
 public static async Task <T> FirstAsync <T>(this Query query)
 {
     return(await QueryHelper.CreateQueryFactory(query).FirstAsync <T>(query));
 }
Exemplo n.º 8
0
        public static async Task <PaginationResult <T> > PaginateAsync <T>(this Query query, int page, int perPage = 25)
        {
            var db = QueryHelper.CreateQueryFactory(query);

            return(await db.PaginateAsync <T>(query, page, perPage));
        }
Exemplo n.º 9
0
 public static async Task <int> DeleteAsync(this Query query)
 {
     return(await QueryHelper.CreateQueryFactory(query)
            .ExecuteAsync(query.AsDelete()));
 }
Exemplo n.º 10
0
 public static async Task <int> UpdateAsync(this Query query, IReadOnlyDictionary <string, object> values)
 {
     return(await QueryHelper.CreateQueryFactory(query)
            .ExecuteAsync(query.AsUpdate(values)));
 }
        public static T Max <T>(this Query query, string column)
        {
            var xQuery = QueryHelper.CastToXQuery(query, nameof(Max));

            return(query.Aggregate <T>("max", column));
        }
        public static T Sum <T>(this Query query, string column)
        {
            var xQuery = QueryHelper.CastToXQuery(query, nameof(Sum));

            return(query.Aggregate <T>("sum", column));
        }
        public static T Average <T>(this Query query, string column)
        {
            var xQuery = QueryHelper.CastToXQuery(query, nameof(Average));

            return(query.Aggregate <T>("avg", column));
        }