import { entityKind } from "../../entity.cjs"; import { QueryPromise } from "../../query-promise.cjs"; import type { RunnableQuery } from "../../runnable-query.cjs"; import type { SingleStoreDialect } from "../dialect.cjs"; import type { AnySingleStoreQueryResultHKT, PreparedQueryHKTBase, PreparedQueryKind, SingleStorePreparedQueryConfig, SingleStoreQueryResultHKT, SingleStoreQueryResultKind, SingleStoreSession } from "../session.cjs"; import type { SingleStoreTable } from "../table.cjs"; import type { Placeholder, Query, SQLWrapper } from "../../sql/sql.cjs"; import { Param, SQL } from "../../sql/sql.cjs"; import type { InferModelFromColumns } from "../../table.cjs"; import type { AnySingleStoreColumn } from "../columns/common.cjs"; import type { SelectedFieldsOrdered } from "./select.types.cjs"; import type { SingleStoreUpdateSetSource } from "./update.cjs"; export interface SingleStoreInsertConfig { table: TTable; values: Record[]; ignore: boolean; onConflict?: SQL; returning?: SelectedFieldsOrdered; } export type AnySingleStoreInsertConfig = SingleStoreInsertConfig; export type SingleStoreInsertValue = { [Key in keyof TTable['$inferInsert']]: TTable['$inferInsert'][Key] | SQL | Placeholder; } & {}; export declare class SingleStoreInsertBuilder { private table; private session; private dialect; static readonly [entityKind]: string; private shouldIgnore; constructor(table: TTable, session: SingleStoreSession, dialect: SingleStoreDialect); ignore(): this; values(value: SingleStoreInsertValue): SingleStoreInsertBase; values(values: SingleStoreInsertValue[]): SingleStoreInsertBase; } export type SingleStoreInsertWithout = TDynamic extends true ? T : Omit, T['_']['excludedMethods'] | K>; export type SingleStoreInsertDynamic = SingleStoreInsert; export type SingleStoreInsertPrepare | undefined = undefined> = PreparedQueryKind : TReturning[]; iterator: never; }, true>; export type SingleStoreInsertOnDuplicateKeyUpdateConfig = { set: SingleStoreUpdateSetSource; }; export type SingleStoreInsert | undefined = Record | undefined> = SingleStoreInsertBase; export type SingleStoreInsertReturning = SingleStoreInsertBase>, TDynamic, T['_']['excludedMethods'] | '$returning'>; export type AnySingleStoreInsert = SingleStoreInsertBase; export interface SingleStoreInsertBase | undefined = undefined, TDynamic extends boolean = false, TExcludedMethods extends string = never> extends QueryPromise : TReturning[]>, RunnableQuery : TReturning[], 'singlestore'>, SQLWrapper { readonly _: { readonly dialect: 'singlestore'; readonly table: TTable; readonly queryResult: TQueryResult; readonly preparedQueryHKT: TPreparedQueryHKT; readonly dynamic: TDynamic; readonly excludedMethods: TExcludedMethods; readonly returning: TReturning; readonly result: TReturning extends undefined ? SingleStoreQueryResultKind : TReturning[]; }; } export type PrimaryKeyKeys> = { [K in keyof T]: T[K]['_']['isPrimaryKey'] extends true ? T[K]['_']['isAutoincrement'] extends true ? K : T[K]['_']['hasRuntimeDefault'] extends true ? T[K]['_']['isPrimaryKey'] extends true ? K : never : never : T[K]['_']['hasRuntimeDefault'] extends true ? T[K]['_']['isPrimaryKey'] extends true ? K : never : never; }[keyof T]; export type GetPrimarySerialOrDefaultKeys> = { [K in PrimaryKeyKeys]: T[K]; }; export declare class SingleStoreInsertBase | undefined = undefined, TDynamic extends boolean = false, TExcludedMethods extends string = never> extends QueryPromise : TReturning[]> implements RunnableQuery : TReturning[], 'singlestore'>, SQLWrapper { private session; private dialect; static readonly [entityKind]: string; protected $table: TTable; private config; constructor(table: TTable, values: SingleStoreInsertConfig['values'], ignore: boolean, session: SingleStoreSession, dialect: SingleStoreDialect); /** * Adds an `on duplicate key update` clause to the query. * * Calling this method will update update the row if any unique index conflicts. MySQL will automatically determine the conflict target based on the primary key and unique indexes. * * See docs: {@link https://orm.drizzle.team/docs/insert#on-duplicate-key-update} * * @param config The `set` clause * * @example * ```ts * await db.insert(cars) * .values({ id: 1, brand: 'BMW'}) * .onDuplicateKeyUpdate({ set: { brand: 'Porsche' }}); * ``` * * While MySQL does not directly support doing nothing on conflict, you can perform a no-op by setting any column's value to itself and achieve the same effect: * * ```ts * import { sql } from 'drizzle-orm'; * * await db.insert(cars) * .values({ id: 1, brand: 'BMW' }) * .onDuplicateKeyUpdate({ set: { id: sql`id` } }); * ``` */ onDuplicateKeyUpdate(config: SingleStoreInsertOnDuplicateKeyUpdateConfig): SingleStoreInsertWithout; $returningId(): SingleStoreInsertWithout, TDynamic, '$returningId'>; toSQL(): Query; prepare(): SingleStoreInsertPrepare; execute: ReturnType['execute']; private createIterator; iterator: ReturnType["iterator"]; $dynamic(): SingleStoreInsertDynamic; }