@algochad/prisma-core
Version:
A comprehensive NestJS library that provides EF-Core-like operations using Prisma and GraphQL. Features LINQ-style query builders, advanced data manipulation, GraphQL integration with genql, and a unified API for both Prisma and GraphQL operations. Includ
48 lines (47 loc) • 2.74 kB
TypeScript
import { IAsyncEnumerable, IEnumerable } from '../../collections';
import { IQueryable } from '../../collections/efcore';
import { GraphQLQueryProvider, IGraphQLQueryExpression, IGenQLClient } from '../../collections/graphql/graphql-queryable';
export declare class GraphQLQueryBuilder<TModel = unknown, TSelect = TModel, TWhereInput = any, TOrderByInput = any, TInclude = any, TSelectInput = any> {
private genqlClient;
private operationName;
private operationType;
private whereClause;
private selectClause?;
private includeClause?;
private orderByClause?;
private firstClause?;
private skipClause?;
private argsClause;
constructor(genqlClient: IGenQLClient, operationName: string, operationType?: 'query' | 'mutation' | 'subscription');
static create<TModel = unknown, TSelect = TModel, TWhereInput = any, TOrderByInput = any, TInclude = any, TSelectInput = any>(genqlClient: IGenQLClient, operationName: string, operationType?: 'query' | 'mutation' | 'subscription'): GraphQLQueryBuilder<TModel, TSelect, TWhereInput, TOrderByInput, TInclude, TSelectInput>;
static createFrom<TModel = unknown, TSelect = TModel, TWhereInput = any, TOrderByInput = any, TInclude = any, TSelectInput = any>(builder: GraphQLQueryBuilder<any, any, any, any, any, any>, genqlClient: IGenQLClient, operationName: string): GraphQLQueryBuilder<TModel, TSelect, TWhereInput, TOrderByInput, TInclude, TSelectInput>;
Where(where: TWhereInput): this;
Select(select: TSelectInput): this;
Include(include: TInclude): this;
OrderBy(orderBy: any): this;
Take(n: number): this;
Skip(n: number): this;
private buildQuery;
ToArray(): Promise<TSelect[]>;
ToArrayAsync(): Promise<TSelect[]>;
First(): Promise<TSelect | null>;
FirstOrDefault(): Promise<TSelect | undefined>;
Single(): Promise<TSelect | null>;
Count(): Promise<number>;
Exists(): Promise<boolean>;
Any(): Promise<boolean>;
Min(field: string): Promise<any>;
Max(field: string): Promise<any>;
Sum(field: string): Promise<number>;
Avg(field: string): Promise<number>;
ToEnumerable(): Promise<IEnumerable<TSelect>>;
Project<TResult>(selector: (item: TSelect) => TResult): Promise<IEnumerable<TResult>>;
get Provider(): GraphQLQueryProvider;
get Expression(): IGraphQLQueryExpression;
AsQueryable(): IQueryable<TModel, TSelect, TWhereInput, TOrderByInput, TInclude, TSelectInput, any, any, any>;
reset(): this;
Fresh(): GraphQLQueryBuilder<TModel, TSelect, TWhereInput, TOrderByInput, TInclude, TSelectInput>;
Subscribe(): AsyncIterable<TSelect>;
AsAsyncEnumerable(): IAsyncEnumerable<TSelect>;
ToAsyncEnumerable(): IAsyncEnumerable<TSelect>;
}