(
fields: F | F[] | RawQueryFragment = [] as F[],
)
| 1914 | } |
| 1915 | |
| 1916 | onConflict<F extends Field<Entity, RootAlias, Context>>( |
| 1917 | fields: F | F[] | RawQueryFragment = [] as F[], |
| 1918 | ): InsertQueryBuilder<Entity, RootAlias, Context> { |
| 1919 | const meta = this.mainAlias.meta as EntityMetadata<Entity>; |
| 1920 | this.ensureNotFinalized(); |
| 1921 | this.#state.onConflict ??= []; |
| 1922 | this.#state.onConflict.push({ |
| 1923 | fields: isRaw(fields) |
| 1924 | ? fields |
| 1925 | : Utils.asArray(fields as string).flatMap(f => { |
| 1926 | const key = f.toString() as EntityKey<Entity>; |
| 1927 | /* v8 ignore next */ |
| 1928 | return meta.properties[key]?.fieldNames ?? [key]; |
| 1929 | }), |
| 1930 | }); |
| 1931 | return this as unknown as InsertQueryBuilder<Entity, RootAlias, Context>; |
| 1932 | } |
| 1933 | |
| 1934 | ignore(): this { |
| 1935 | if (!this.#state.onConflict) { |
no test coverage detected