Creates a new SQL array parameter
SQL.array method | Bun module | Bun BuildDocsReferenceGuidesBlogDiscord/Bun/SQL/arrayMarray BuildDocsReferenceGuidesBlogDiscord /Bun/SQL/arrayMarray SQL.arrayarray(values: any[],typeNameOrTypeID?: number | ArrayType): SQLArrayParameter; @param values @param typeNameOrTypeID @returns Referenced typestype ArrayType = 'BOOLEAN' | 'BYTEA' | 'CHAR' | 'NAME' | 'TEXT' | 'CHAR' | 'VARCHAR' | 'SMALLINT' | 'INT2VECTOR' | 'INTEGER' | 'INT' | 'BIGINT' | 'REAL' | 'DOUBLE PRECISION' | 'NUMERIC' | 'MONEY' | 'OID' | 'TID' | 'XID' | 'CID' | 'JSON' | 'JSONB' | 'JSONPATH' | 'XML' | 'POINT' | 'LSEG' | 'PATH' | 'BOX' | 'POLYGON' | 'LINE' | 'CIRCLE' | 'CIDR' | 'MACADDR' | 'INET' | 'MACADDR8' | 'DATE' | 'TIME' | 'TIMESTAMP' | 'TIMESTAMPTZ' | 'INTERVAL' | 'TIMETZ' | 'BIT' | 'VARBIT' | 'ACLITEM' | 'PG_DATABASE' | string & {}interface SQLArrayParameter arrayType: ArrayType serializedValues: string
Search the reference...
/
method
The values to create the array parameter from
The type name or type ID to create the array parameter from, if omitted it will default to JSON
A new SQL array parameter
const array = sql.array([1, 2, 3], "INT");
await sql`CREATE TABLE users_posts (user_id INT, posts_id INT[])`;
await sql`INSERT INTO users_posts (user_id, posts_id) VALUES (${user.id}, ${array})`;
Represents a SQL array parameter
The type of the array parameter
The serialized values of the array parameter
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlogToolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →SQL.array method | Bun module | Bun,AI智能索引,全网链接索引,智能导航,网页索引
- API documentation for method bun.SQL.array | Bun