Home > @loopback/typeorm > TypeOrmMixin
TypeOrmMixin() function
Signature:
export declare function TypeOrmMixin<T extends MixinTarget<Application>>(superClass: T): {
new (...args: any[]): {
connectionManager: ConnectionManager;
connection(connectionConfig: ConnectionOptions): Binding<Connection>;
migrateSchema(): Promise<void>;
readonly options: import("@loopback/core").ApplicationConfig;
readonly state: string;
controller: <T>(controllerCtor: import("@loopback/core").ControllerClass<T>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined) => Binding<T>;
server: <T_1 extends import("@loopback/core").Server>(ctor: import("@loopback/core").Constructor<T_1>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined) => Binding<T_1>;
servers: <T_2 extends import("@loopback/core").Server>(ctors: import("@loopback/core").Constructor<T_2>[]) => Binding<any>[];
getServer: <T_3 extends import("@loopback/core").Server>(target: string | import("@loopback/core").Constructor<T_3>) => Promise<T_3>;
init: () => Promise<void>;
onInit: (fn: () => import("@loopback/core").ValueOrPromise<void>) => Binding<LifeCycleObserver>;
start: () => Promise<void>;
onStart: (fn: () => import("@loopback/core").ValueOrPromise<void>) => Binding<LifeCycleObserver>;
stop: () => Promise<void>;
onStop: (fn: () => import("@loopback/core").ValueOrPromise<void>) => Binding<LifeCycleObserver>;
component: <T_4 extends Component = Component>(componentCtor: import("@loopback/core").Constructor<T_4>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined) => Binding<T_4>;
setMetadata: (metadata: import("@loopback/core").ApplicationMetadata) => void;
lifeCycleObserver: <T_5 extends LifeCycleObserver>(ctor: import("@loopback/core").Constructor<T_5>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined) => Binding<T_5>;
service: <S>(cls: import("@loopback/core").ServiceOrProviderClass<S>, nameOrOptions?: string | import("@loopback/core").ServiceOptions | undefined) => Binding<S>;
interceptor: (interceptor: import("@loopback/core").Interceptor | import("@loopback/core").Constructor<import("@loopback/core").Provider<import("@loopback/core").Interceptor>>, nameOrOptions?: string | import("@loopback/core").InterceptorBindingOptions | undefined) => Binding<import("@loopback/core").Interceptor>;
readonly name: string;
readonly subscriptionManager: import("@loopback/core").ContextSubscriptionManager;
scope: BindingScope;
readonly parent: import("@loopback/core").Context | undefined;
emitEvent: <T_6 extends import("@loopback/core").ContextEvent>(type: string, event: T_6) => void;
emitError: (err: unknown) => void;
bind: <ValueType = any>(key: import("@loopback/core").BindingAddress<ValueType>) => Binding<ValueType>;
add: (binding: Binding<unknown>) => Application;
configure: <ConfigValueType = any>(key?: import("@loopback/core").BindingAddress | undefined) => Binding<ConfigValueType>;
getConfigAsValueOrPromise: <ConfigValueType_1>(key: import("@loopback/core").BindingAddress, propertyPath?: string | undefined, resolutionOptions?: import("@loopback/core").ResolutionOptions | undefined) => import("@loopback/core").ValueOrPromise<ConfigValueType_1 | undefined>;
getConfig: <ConfigValueType_2>(key: import("@loopback/core").BindingAddress, propertyPath?: string | undefined, resolutionOptions?: import("@loopback/core").ResolutionOptions | undefined) => Promise<ConfigValueType_2 | undefined>;
getConfigSync: <ConfigValueType_3>(key: import("@loopback/core").BindingAddress, propertyPath?: string | undefined, resolutionOptions?: import("@loopback/core").ResolutionOptions | undefined) => ConfigValueType_3 | undefined;
unbind: (key: import("@loopback/core").BindingAddress) => boolean;
subscribe: (observer: import("@loopback/core").ContextEventObserver) => import("@loopback/core").Subscription;
unsubscribe: (observer: import("@loopback/core").ContextEventObserver) => boolean;
close: () => void;
isSubscribed: (observer: import("@loopback/core").ContextObserver) => boolean;
createView: <T_7 = unknown>(filter: import("@loopback/core").BindingFilter, comparator?: import("@loopback/core").BindingComparator | undefined, options?: Omit<import("@loopback/core").ResolutionOptions, "session"> | undefined) => import("@loopback/core").ContextView<T_7>;
contains: (key: import("@loopback/core").BindingAddress) => boolean;
isBound: (key: import("@loopback/core").BindingAddress) => boolean;
getOwnerContext: (keyOrBinding: import("@loopback/core").BindingAddress | Readonly<Binding<unknown>>) => import("@loopback/core").Context | undefined;
getScopedContext: (scope: BindingScope.APPLICATION | BindingScope.SERVER | BindingScope.REQUEST) => import("@loopback/core").Context | undefined;
getResolutionContext: (binding: Readonly<Binding<unknown>>) => import("@loopback/core").Context | undefined;
isVisibleTo: (ctx: import("@loopback/core").Context) => boolean;
find: <ValueType_1 = any>(pattern?: string | RegExp | import("@loopback/core").BindingFilter | undefined) => Readonly<Binding<ValueType_1>>[];
findByTag: <ValueType_2 = any>(tagFilter: RegExp | import("@loopback/core").BindingTag) => Readonly<Binding<ValueType_2>>[];
get: {
<ValueType_3>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_3>, session?: import("@loopback/core").ResolutionSession | undefined): Promise<ValueType_3>;
<ValueType_4>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_4>, options: import("@loopback/core").ResolutionOptions): Promise<ValueType_4 | undefined>;
};
getSync: {
<ValueType_5>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_5>, session?: import("@loopback/core").ResolutionSession | undefined): ValueType_5;
<ValueType_6>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_6>, options?: import("@loopback/core").ResolutionOptions | undefined): ValueType_6 | undefined;
};
getBinding: {
<ValueType_7 = any>(key: import("@loopback/core").BindingAddress<ValueType_7>): Binding<ValueType_7>;
<ValueType_8>(key: import("@loopback/core").BindingAddress<ValueType_8>, options?: {
optional?: boolean | undefined;
} | undefined): Binding<ValueType_8> | undefined;
};
findOrCreateBinding: <T_8>(key: import("@loopback/core").BindingAddress<T_8>, policy?: import("@loopback/core").BindingCreationPolicy | undefined) => Binding<T_8>;
getValueOrPromise: <ValueType_9>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_9>, optionsOrSession?: import("@loopback/core").ResolutionOptionsOrSession | undefined) => import("@loopback/core").ValueOrPromise<ValueType_9 | undefined>;
toJSON: () => import("@loopback/core").JSONObject;
inspect: (options?: import("@loopback/core").ContextInspectOptions | undefined) => import("@loopback/core").JSONObject;
on: {
(eventName: "bind" | "unbind", listener: import("@loopback/core").ContextEventListener): Application;
(event: string | symbol, listener: (...args: any[]) => void): Application;
};
once: {
(eventName: "bind" | "unbind", listener: import("@loopback/core").ContextEventListener): Application;
(event: string | symbol, listener: (...args: any[]) => void): Application;
};
addListener: (eventName: string | symbol, listener: (...args: any[]) => void) => Application;
removeListener: (eventName: string | symbol, listener: (...args: any[]) => void) => Application;
off: (eventName: string | symbol, listener: (...args: any[]) => void) => Application;
removeAllListeners: (event?: string | symbol | undefined) => Application;
setMaxListeners: (n: number) => Application;
getMaxListeners: () => number;
listeners: (eventName: string | symbol) => Function[];
rawListeners: (eventName: string | symbol) => Function[];
emit: (eventName: string | symbol, ...args: any[]) => boolean;
listenerCount: (eventName: string | symbol) => number;
prependListener: (eventName: string | symbol, listener: (...args: any[]) => void) => Application;
prependOnceListener: (eventName: string | symbol, listener: (...args: any[]) => void) => Application;
eventNames: () => (string | symbol)[];
};
} & T;
Parameters
Parameter | Type | Description |
---|---|---|
superClass | T |
Returns:
{ new (…args: any[]): { connectionManager: ConnectionManager; connection(connectionConfig: ConnectionOptions): Binding<Connection>; migrateSchema(): Promise<void>; readonly options: import(“@loopback/core”).ApplicationConfig; readonly state: string; controller: <T>(controllerCtor: import(“@loopback/core”).ControllerClass<T>, nameOrOptions?: string | import(“@loopback/core”).BindingFromClassOptions | undefined) => Binding<T>; server: <T_1 extends import(“@loopback/core”).Server>(ctor: import(“@loopback/core”).Constructor<T_1>, nameOrOptions?: string | import(“@loopback/core”).BindingFromClassOptions | undefined) => Binding<T_1>; servers: <T_2 extends import(“@loopback/core”).Server>(ctors: import(“@loopback/core”).Constructor<T_2>[]) => Binding<any>[]; getServer: <T_3 extends import(“@loopback/core”).Server>(target: string | import(“@loopback/core”).Constructor<T_3>) => Promise<T_3>; init: () => Promise<void>; onInit: (fn: () => import(“@loopback/core”).ValueOrPromise<void>) => Binding<LifeCycleObserver>; start: () => Promise<void>; onStart: (fn: () => import(“@loopback/core”).ValueOrPromise<void>) => Binding<LifeCycleObserver>; stop: () => Promise<void>; onStop: (fn: () => import(“@loopback/core”).ValueOrPromise<void>) => Binding<LifeCycleObserver>; component: <T_4 extends Component = Component>(componentCtor: import(“@loopback/core”).Constructor<T_4>, nameOrOptions?: string | import(“@loopback/core”).BindingFromClassOptions | undefined) => Binding<T_4>; setMetadata: (metadata: import(“@loopback/core”).ApplicationMetadata) => void; lifeCycleObserver: <T_5 extends LifeCycleObserver>(ctor: import(“@loopback/core”).Constructor<T_5>, nameOrOptions?: string | import(“@loopback/core”).BindingFromClassOptions | undefined) => Binding<T_5>; service: <S>(cls: import(“@loopback/core”).ServiceOrProviderClass<S>, nameOrOptions?: string | import(“@loopback/core”).ServiceOptions | undefined) => Binding<S>; interceptor: (interceptor: import(“@loopback/core”).Interceptor | import(“@loopback/core”).Constructor<import(“@loopback/core”).Provider<import(“@loopback/core”).Interceptor>>, nameOrOptions?: string | import(“@loopback/core”).InterceptorBindingOptions | undefined) => Binding<import(“@loopback/core”).Interceptor>; readonly name: string; readonly subscriptionManager: import(“@loopback/core”).ContextSubscriptionManager; scope: BindingScope; readonly parent: import(“@loopback/core”).Context | undefined; emitEvent: <T_6 extends import(“@loopback/core”).ContextEvent>(type: string, event: T_6) => void; emitError: (err: unknown) => void; bind: <ValueType = any>(key: import(“@loopback/core”).BindingAddress<ValueType>) => Binding<ValueType>; add: (binding: Binding<unknown>) => Application; configure: <ConfigValueType = any>(key?: import(“@loopback/core”).BindingAddress | undefined) => Binding<ConfigValueType>; getConfigAsValueOrPromise: <ConfigValueType_1>(key: import(“@loopback/core”).BindingAddress, propertyPath?: string | undefined, resolutionOptions?: import(“@loopback/core”).ResolutionOptions | undefined) => import(“@loopback/core”).ValueOrPromise<ConfigValueType_1 | undefined>; getConfig: <ConfigValueType_2>(key: import(“@loopback/core”).BindingAddress, propertyPath?: string | undefined, resolutionOptions?: import(“@loopback/core”).ResolutionOptions | undefined) => Promise<ConfigValueType_2 | undefined>; getConfigSync: <ConfigValueType_3>(key: import(“@loopback/core”).BindingAddress, propertyPath?: string | undefined, resolutionOptions?: import(“@loopback/core”).ResolutionOptions | undefined) => ConfigValueType_3 | undefined; unbind: (key: import(“@loopback/core”).BindingAddress) => boolean; subscribe: (observer: import(“@loopback/core”).ContextEventObserver) => import(“@loopback/core”).Subscription; unsubscribe: (observer: import(“@loopback/core”).ContextEventObserver) => boolean; close: () => void; isSubscribed: (observer: import(“@loopback/core”).ContextObserver) => boolean; createView: <T_7 = unknown>(filter: import(“@loopback/core”).BindingFilter, comparator?: import(“@loopback/core”).BindingComparator | undefined, options?: Omit<import(“@loopback/core”).ResolutionOptions, “session”> | undefined) => import(“@loopback/core”).ContextView<T_7>; contains: (key: import(“@loopback/core”).BindingAddress) => boolean; isBound: (key: import(“@loopback/core”).BindingAddress) => boolean; getOwnerContext: (keyOrBinding: import(“@loopback/core”).BindingAddress | Readonly<Binding<unknown>>) => import(“@loopback/core”).Context | undefined; getScopedContext: (scope: BindingScope.APPLICATION | BindingScope.SERVER | BindingScope.REQUEST) => import(“@loopback/core”).Context | undefined; getResolutionContext: (binding: Readonly<Binding<unknown>>) => import(“@loopback/core”).Context | undefined; isVisibleTo: (ctx: import(“@loopback/core”).Context) => boolean; find: <ValueType_1 = any>(pattern?: string | RegExp | import(“@loopback/core”).BindingFilter | undefined) => Readonly<Binding<ValueType_1>>[]; findByTag: <ValueType_2 = any>(tagFilter: RegExp | import(“@loopback/core”).BindingTag) => Readonly<Binding<ValueType_2>>[]; get: { <ValueType_3>(keyWithPath: import(“@loopback/core”).BindingAddress<ValueType_3>, session?: import(“@loopback/core”).ResolutionSession | undefined): Promise<ValueType_3>; <ValueType_4>(keyWithPath: import(“@loopback/core”).BindingAddress<ValueType_4>, options: import(“@loopback/core”).ResolutionOptions): Promise<ValueType_4 | undefined>; }; getSync: { <ValueType_5>(keyWithPath: import(“@loopback/core”).BindingAddress<ValueType_5>, session?: import(“@loopback/core”).ResolutionSession | undefined): ValueType_5; <ValueType_6>(keyWithPath: import(“@loopback/core”).BindingAddress<ValueType_6>, options?: import(“@loopback/core”).ResolutionOptions | undefined): ValueType_6 | undefined; }; getBinding: { <ValueType_7 = any>(key: import(“@loopback/core”).BindingAddress<ValueType_7>): Binding<ValueType_7>; <ValueType_8>(key: import(“@loopback/core”).BindingAddress<ValueType_8>, options?: { optional?: boolean | undefined; } | undefined): Binding<ValueType_8> | undefined; }; findOrCreateBinding: <T_8>(key: import(“@loopback/core”).BindingAddress<T_8>, policy?: import(“@loopback/core”).BindingCreationPolicy | undefined) => Binding<T_8>; getValueOrPromise: <ValueType_9>(keyWithPath: import(“@loopback/core”).BindingAddress<ValueType_9>, optionsOrSession?: import(“@loopback/core”).ResolutionOptionsOrSession | undefined) => import(“@loopback/core”).ValueOrPromise<ValueType_9 | undefined>; toJSON: () => import(“@loopback/core”).JSONObject; inspect: (options?: import(“@loopback/core”).ContextInspectOptions | undefined) => import(“@loopback/core”).JSONObject; on: { (eventName: “bind” | “unbind”, listener: import(“@loopback/core”).ContextEventListener): Application; (event: string | symbol, listener: (…args: any[]) => void): Application; }; once: { (eventName: “bind” | “unbind”, listener: import(“@loopback/core”).ContextEventListener): Application; (event: string | symbol, listener: (…args: any[]) => void): Application; }; addListener: (eventName: string | symbol, listener: (…args: any[]) => void) => Application; removeListener: (eventName: string | symbol, listener: (…args: any[]) => void) => Application; off: (eventName: string | symbol, listener: (…args: any[]) => void) => Application; removeAllListeners: (event?: string | symbol | undefined) => Application; setMaxListeners: (n: number) => Application; getMaxListeners: () => number; listeners: (eventName: string | symbol) => Function[]; rawListeners: (eventName: string | symbol) => Function[]; emit: (eventName: string | symbol, …args: any[]) => boolean; listenerCount: (eventName: string | symbol) => number; prependListener: (eventName: string | symbol, listener: (…args: any[]) => void) => Application; prependOnceListener: (eventName: string | symbol, listener: (…args: any[]) => void) => Application; eventNames: () => (string | symbol)[]; }; } & T