Skip to main content
Home

Built and signed on GitHub Actions

Generates SQL commands for creating tables, inserting data, and performing operations like text search and matching in PostgreSQL databases.

This package works with Node.js, DenoIt is unknown whether this package works with Cloudflare Workers, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
100%
Published
2 weeks ago (0.1.2)
function createIndex
createIndex(
name: string,
table: string,
expr: string,
acc?: string,
): string

Generate SQL command for CREATE INDEX.

Examples

Example 1

xsql.createIndex("food_code_idx", "food", `"code"`);
// → CREATE INDEX IF NOT EXISTS "food_code_idx" ON "food" ("code");

xsql.createIndex("food_type_idx", "food", `"type"`, {method: "GIN"});
// → CREATE INDEX IF NOT EXISTS "food_type_idx" ON "food" USING GIN ("type");

Parameters

name: string

index name

table: string

table name

expr: string

index expression

optional
opt: CreateIndexOptions

options {method}

optional
acc: string =

string to accumulate to (internal use)

Return Type

SQL command for creating the index

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@nodef/extra-sql

Import symbol

import { createIndex } from "@nodef/extra-sql";
or

Import directly with a jsr specifier

import { createIndex } from "jsr:@nodef/extra-sql";

Add Package

pnpm i jsr:@nodef/extra-sql
or (using pnpm 10.8 or older)
pnpm dlx jsr add @nodef/extra-sql

Import symbol

import { createIndex } from "@nodef/extra-sql";

Add Package

yarn add jsr:@nodef/extra-sql
or (using Yarn 4.8 or older)
yarn dlx jsr add @nodef/extra-sql

Import symbol

import { createIndex } from "@nodef/extra-sql";

Add Package

npx jsr add @nodef/extra-sql

Import symbol

import { createIndex } from "@nodef/extra-sql";

Add Package

bunx jsr add @nodef/extra-sql

Import symbol

import { createIndex } from "@nodef/extra-sql";