MCPcopy Index your code
hub / github.com/tinyplex/tinybase / createFunction

Function createFunction

src/persisters/common/database/postgresql.ts:81–97  ·  view source on GitHub ↗
(
    name: string,
    body: string,
    returnPrefix = '',
    declarations = '',
  )

Source from the content-addressed store, hash-verified

79 const channel = TINYBASE + '_' + configHash;
80
81 const createFunction = async (
82 name: string,
83 body: string,
84 returnPrefix = '',
85 declarations = '',
86 ): Promise<string> => {
87 const escapedFunctionName = escapeIds(TINYBASE, name, configHash);
88 await executeCommand(
89 CREATE +
90 OR_REPLACE +
91 FUNCTION +
92 escapedFunctionName +
93 `()RETURNS ${returnPrefix}trigger ` +
94 `AS $$ ${declarations}BEGIN ${body}END;$$ LANGUAGE plpgsql;`,
95 );
96 return escapedFunctionName;
97 };
98
99 const createTrigger = async (
100 prefix: string,

Callers 1

addPersisterListenerFunction · 0.85

Calls 1

escapeIdsFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…