| 8 | import type { AbortableQueryOptions } from '../util/abort.js' |
| 9 | |
| 10 | export class DropTableBuilder implements OperationNodeSource, Compilable { |
| 11 | readonly #props: DropTableBuilderProps |
| 12 | |
| 13 | constructor(props: DropTableBuilderProps) { |
| 14 | this.#props = freeze(props) |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Adds the "temporary" modifier. |
| 19 | * |
| 20 | * This is only supported by some dialects like MySQL. |
| 21 | */ |
| 22 | temporary(): DropTableBuilder { |
| 23 | return new DropTableBuilder({ |
| 24 | ...this.#props, |
| 25 | node: DropTableNode.cloneWith(this.#props.node, { |
| 26 | temporary: true, |
| 27 | }), |
| 28 | }) |
| 29 | } |
| 30 | |
| 31 | ifExists(): DropTableBuilder { |
| 32 | return new DropTableBuilder({ |
| 33 | ...this.#props, |
| 34 | node: DropTableNode.cloneWith(this.#props.node, { |
| 35 | ifExists: true, |
| 36 | }), |
| 37 | }) |
| 38 | } |
| 39 | |
| 40 | cascade(): DropTableBuilder { |
| 41 | return new DropTableBuilder({ |
| 42 | ...this.#props, |
| 43 | node: DropTableNode.cloneWith(this.#props.node, { |
| 44 | cascade: true, |
| 45 | }), |
| 46 | }) |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Simply calls the provided function passing `this` as the only argument. `$call` returns |
| 51 | * what the provided function returns. |
| 52 | */ |
| 53 | $call<T>(func: (qb: this) => T): T { |
| 54 | return func(this) |
| 55 | } |
| 56 | |
| 57 | toOperationNode(): DropTableNode { |
| 58 | return this.#props.executor.transformQuery( |
| 59 | this.#props.node, |
| 60 | this.#props.queryId, |
| 61 | ) |
| 62 | } |
| 63 | |
| 64 | compile(): CompiledQuery { |
| 65 | return this.#props.executor.compileQuery( |
| 66 | this.toOperationNode(), |
| 67 | this.#props.queryId, |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…