Documentation
    Preparing search index...

    Class SQLiteInsertBase<TTable, TResultType, TRunResult, TReturning, TDynamic, TExcludedMethods>

    Type Parameters

    • TTable extends SQLiteTable
    • TResultType extends "sync" | "async"
    • TRunResult
    • TReturning = undefined
    • TDynamic extends boolean = false
    • TExcludedMethods extends string = never

    Hierarchy

    Implements

    Index

    Constructors

    Properties

    _: {
        dialect: "sqlite";
        dynamic: TDynamic;
        excludedMethods: TExcludedMethods;
        result: TReturning extends undefined ? TRunResult : TReturning[];
        resultType: TResultType;
        returning: TReturning;
        runResult: TRunResult;
        table: TTable;
    }
    "[toStringTag]": string
    all: (
        placeholderValues?: Record<string, unknown>,
    ) => Result<
        TResultType,
        TReturning extends undefined
            ? DrizzleTypeError<".all() cannot be used without .returning()">
            : TReturning[],
    >
    get: (
        placeholderValues?: Record<string, unknown>,
    ) => Result<
        TResultType,
        TReturning extends undefined
            ? DrizzleTypeError<".get() cannot be used without .returning()">
            : TReturning,
    >
    run: (
        placeholderValues?: Record<string, unknown>,
    ) => Result<TResultType, TRunResult>
    values: (
        placeholderValues?: Record<string, unknown>,
    ) => Result<
        TResultType,
        TReturning extends undefined
            ? DrizzleTypeError<".values() cannot be used without .returning()">
            : any[][],
    >
    "[entityKind]": string

    Methods

    • Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

      Parameters

      • OptionalonFinally: (() => void) | null

      Returns Promise<TReturning extends undefined ? TRunResult : TReturning[]>

      A Promise for the completion of the callback.

    • Adds an on conflict do nothing clause to the query.

      Calling this method simply avoids inserting a row as its alternative action.

      See docs: https://orm.drizzle.team/docs/insert#on-conflict-do-nothing

      Parameters

      Returns this

      // Insert one row and cancel the insert if there's a conflict
      await db.insert(cars)
      .values({ id: 1, brand: 'BMW' })
      .onConflictDoNothing();

      // Explicitly specify conflict target
      await db.insert(cars)
      .values({ id: 1, brand: 'BMW' })
      .onConflictDoNothing({ target: cars.id });