pg-structure / NormalFunction
# Class: NormalFunction
Class which represent a PostgreSQL (normal function.
Provides attributes and methods for details of the normal function.
Class name is NormalFunction
because procedures, aggregate functions, and window functions are
classified as functions by PostgreSQL. The term "normal function" is used by PostgreSQL.
See prokind
attribute at https://www.postgresql.org/docs/12/catalog-pg-proc.html.
# Hierarchy
-
↳ NormalFunction
# Properties
# arguments
• Readonly
arguments: default<FunctionArgument, name, argumentNumber, true>
All function arguments of the {@link Function function} as an {@link IndexableArray indexable array} ordered by same order they are defined in PostgreSQL {@link Function function}.
Please note that, name
is not required for PostgreSQL function arguments. There may be multiple empty string arguments.
{@link IndexableArray https://www.npmjs.com/package/indexable-array} returns first one.
You may also use getAll
to get all unnamed arguments as an array.
# Example
myFunc.arguments.get("maxVal");
myFunc.arguments.getAll("");
Inherited from: Func.arguments
Defined in: pg-structure/base/func.ts:146
# comment
• Optional
Readonly
comment: undefined | string
Comment of the database object defined in database including {@link DbObject#commentData comment data}.
Defined in: pg-structure/base/db-object.ts:75
# estimatedCost
• Readonly
estimatedCost: number
Estimated execution cost (in units of cpu_operator_cost); if proretset, this is cost per row returned
Inherited from: Func.estimatedCost
Defined in: pg-structure/base/func.ts:108
# estimatedRows
• Readonly
estimatedRows: number
Estimated number of result rows (zero if not proretset)
Inherited from: Func.estimatedRows
Defined in: pg-structure/base/func.ts:111
# isLeakProof
• Readonly
isLeakProof: boolean
The function has no side effects. No information about the arguments is conveyed except via the return value. Any function that might throw an error depending on the values of its arguments is not leak-proof.
Inherited from: Func.isLeakProof
Defined in: pg-structure/base/func.ts:114
# isStrict
• Readonly
isStrict: boolean
Whether function returns null if any call argument is null.
Defined in: pg-structure/base/func.ts:117
# language
• Readonly
language: string
Language name of the function.
Defined in: pg-structure/base/func.ts:105
# name
• Readonly
name: string
Name of the database object.
Defined in: pg-structure/base/db-object.ts:42
# oid
• Readonly
oid: number
Object identifier for the {@link Function}
Defined in: pg-structure/base/func.ts:96
# parallelSafety
• Readonly
parallelSafety: ParallelSafety
whether the function can be safely run in parallel mode.
Inherited from: Func.parallelSafety
Defined in: pg-structure/base/func.ts:120
# returnType
• Readonly
returnType: Type
Data type of the return value.
Inherited from: Func.returnType
Defined in: pg-structure/base/func.ts:126
# returnsArray
• Readonly
returnsArray: boolean= false
Whether function returns an array.
Inherited from: Func.returnsArray
Defined in: pg-structure/base/func.ts:132
# returnsSet
• Readonly
returnsSet: boolean
Whether function returns a set.
Inherited from: Func.returnsSet
Defined in: pg-structure/base/func.ts:129
# schema
• Readonly
schema: Schema
Schema of the object.
Defined in: pg-structure/base/func.ts:99
# source
• Readonly
source: string
Source definition of the function.
Defined in: pg-structure/base/func.ts:102
# volatility
• Readonly
volatility: Volatility
Whether the function's result depends only on its input arguments, or is affected by outside factors.
Inherited from: Func.volatility
Defined in: pg-structure/base/func.ts:123
# Accessors
# commentData
• get commentData(): undefined | null | string | number | boolean | JSONObject | JSONArray
Data which is extracted from database object's comment. Data is extracted from text between special case-insensitive tag
(default: [pg-structure][/pg-structure]
) and converted to JavaScript object using JSON5 (opens new window).
Token name can be specified by using commentDataToken
arguments.
For details of JSON5 (opens new window), see it's web site: https://json5.org (opens new window).
# Example
// "Account details. [pg-structure]{ extraData: 2 }[/pg-structure] Also used for logging."
table.comment; // "Account details. [pg-structure]{ extraData: 2 }[/pg-structure] Also used for logging."
table.commentWithoutData; // "Account details. Also used for logging."
table.commentData; // { extraData: 2 }
table.commentData.extraData; // 2
Returns: undefined | null | string | number | boolean | JSONObject | JSONArray
Defined in: pg-structure/base/db-object.ts:102
# commentWithoutData
• get commentWithoutData(): undefined | string
Description or comment of the database object defined in database. If comment contains {@link DbObject#commentData comment data}, it is removed.
# Example
// "Account details. [pg-structure]{ extraData: 2 }[/pg-structure] Also used for logging."
table.commentWithoutData; // "Account details. Also used for logging."
Returns: undefined | string
Defined in: pg-structure/base/db-object.ts:85
# db
• get db(): Db
Database of the database object.
Returns: Db
Defined in: pg-structure/base/db-object.ts:68
# fullCatalogName
• get fullCatalogName(): string
Full name of the database object including database name.
Returns: string
Defined in: pg-structure/base/db-object.ts:35
# fullName
• get fullName(): string
Full name of the object with '.' notation including Schema name.
# Example
const fullName = func.fullName; // public.some_func
Returns: string
Defined in: pg-structure/base/func.ts:158
# nameCaseType
• get nameCaseType(): CaseType
Letter casing (i.e snakeCase
or camelCase
) of the database object name.
# Example
const name = entity.name; // ProductDetail
const caseType = entity.nameCaseType; // camelCase
const otherEntity = otherEntity.name; // member_protocol
const otherCaseType = otherEntity.nameCaseType; // snakeCase
Returns: CaseType
Defined in: pg-structure/base/db-object.ts:54
# separator
• get separator(): string
Separator used in database object name. Empty string for came case and underscore for (_) snake case.
Returns: string
Defined in: pg-structure/base/db-object.ts:61