MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / createQueryBuilder

Function createQueryBuilder

packages/sql/src/AbstractSqlDriver.ts:2933–2962  ·  view source on GitHub ↗

@internal

(
    entityName: EntityName<T> | AnyQueryBuilder<T>,
    ctx?: Transaction,
    preferredConnectionType?: ConnectionType,
    convertCustomTypes?: boolean,
    loggerContext?: LoggingOptions,
    alias?: string,
    em?: SqlEntityManager,
  )

Source from the content-addressed store, hash-verified

2931
2932 /** @internal */
2933 createQueryBuilder<T extends object>(
2934 entityName: EntityName<T> | AnyQueryBuilder<T>,
2935 ctx?: Transaction,
2936 preferredConnectionType?: ConnectionType,
2937 convertCustomTypes?: boolean,
2938 loggerContext?: LoggingOptions,
2939 alias?: string,
2940 em?: SqlEntityManager,
2941 ): AnyQueryBuilder<T> {
2942 // do not compute the connectionType if EM is provided as it will be computed from it in the QB later on
2943 const connectionType = em
2944 ? preferredConnectionType
2945 : this.resolveConnectionType({ ctx, connectionType: preferredConnectionType });
2946 const qb = new QueryBuilder<T>(
2947 entityName,
2948 this.metadata,
2949 this,
2950 ctx,
2951 alias,
2952 connectionType,
2953 em,
2954 loggerContext,
2955 ) as AnyQueryBuilder<T>;
2956
2957 if (!convertCustomTypes) {
2958 qb.unsetFlag(QueryFlag.CONVERT_CUSTOM_TYPES);
2959 }
2960
2961 return qb;
2962 }
2963
2964 /**
2965 * Renders a `FilterQuery` predicate into a SQL fragment (without the `WHERE` keyword and

Callers

nothing calls this directly

Calls 1

unsetFlagMethod · 0.65

Tested by

no test coverage detected