温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/bun/SQL/array
点击访问原文链接

SQL.array method | Bun module | Bun

SQL.array method | Bun module | BunBuildDocsReferenceGuidesBlogDiscord/Bun/SQL/arrayMarray

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/Bun/SQL/arrayMarray

method

SQL.arrayarray(values: any[],typeNameOrTypeID?: number | ArrayType): SQLArrayParameter;

Creates a new SQL array parameter

@param values

The values to create the array parameter from

@param typeNameOrTypeID

The type name or type ID to create the array parameter from, if omitted it will default to JSON

@returns

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})`;
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

Represents a SQL array parameter

arrayType: ArrayType

The type of the array parameter

serializedValues: string

The serialized values of the array parameter

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

SQL.array method | Bun module | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for method bun.SQL.array | Bun