MCPcopy Create free account
hub / github.com/Effect-TS/effect / validateChannelName

Function validateChannelName

packages/sql/pg/src/internal/sqlError.ts:25–29  ·  view source on GitHub ↗
(channel: string, operation: string)

Source from the content-addressed store, hash-verified

23const channelNameEncoder = new TextEncoder()
24
25export const validateChannelName = (channel: string, operation: string): SqlError | undefined => {
26 if (channelNameEncoder.encode(channel).byteLength <= 63) return undefined
27 const message = "PostgreSQL channel names must not exceed 63 UTF-8 bytes"
28 return new SqlError({ reason: new UnknownError({ cause: new Error(message), message, operation }) })
29}
30
31const normalizeConstraint = (constraint: unknown): string => {
32 if (typeof constraint !== "string") return "unknown"

Callers 2

PgClient.tsFile · 0.90
listenChannelFunction · 0.90

Calls 1

encodeMethod · 0.80

Tested by

no test coverage detected