# Class: Func

Class which represent a PostgreSQL (function. Provides attributes and methods for details of the function. Class name is Func instead of Function, because Function is a reserved word in JavaScript, and cannot be used as a class name.

# Hierarchy

# Properties

# Readonly arguments

arguments: IndexableArray‹FunctionArgument, "name", "argumentNumber", true› = IndexableArray.throwingFrom( [], "name", "argumentNumber" )

Defined in src/pg-structure/base/func.ts:146

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 unnaed arguments as an array.

# Example


# Optional Readonly comment

comment? : undefined | string

Inherited from MaterializedView.comment

Defined in src/pg-structure/base/db-object.ts:75

Comment of the database object defined in database including {@link DbObject#commentData comment data}.

# Readonly estimatedCost

estimatedCost: number

Defined in src/pg-structure/base/func.ts:108

Estimated execution cost (in units of cpu_operator_cost); if proretset, this is cost per row returned

# Readonly estimatedRows

estimatedRows: number

Defined in src/pg-structure/base/func.ts:111

Estimated number of result rows (zero if not proretset)

# Readonly isLeakProof

isLeakProof: boolean

Defined in src/pg-structure/base/func.ts:114

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.

# Readonly isStrict

isStrict: boolean

Defined in src/pg-structure/base/func.ts:117

Whether function returns null if any call argument is null.

# Readonly language

language: string

Defined in src/pg-structure/base/func.ts:105

Language name of the function.

# Readonly name

name: string

Inherited from MaterializedView.name

Defined in src/pg-structure/base/db-object.ts:42

Name of the database object.

# Readonly oid

oid: number

Defined in src/pg-structure/base/func.ts:96

Object identifier for the {@link Function}

# Readonly parallelSafety

parallelSafety: ParallelSafety

Defined in src/pg-structure/base/func.ts:120

whether the function can be safely run in parallel mode.

# Readonly returnType

returnType: Type

Defined in src/pg-structure/base/func.ts:126

Data type of the return value.

# Readonly returnsArray

returnsArray: boolean = false

Defined in src/pg-structure/base/func.ts:132

Whether function returns an array.

# Readonly returnsSet

returnsSet: boolean

Defined in src/pg-structure/base/func.ts:129

Whether function returns a set.

# Readonly schema

schema: Schema

Overrides Constraint.schema

Defined in src/pg-structure/base/func.ts:99

Schema of the object.

# Readonly source

source: string

Defined in src/pg-structure/base/func.ts:102

Source definition of the function.

# Readonly volatility

volatility: Volatility

Defined in src/pg-structure/base/func.ts:123

Whether the function's result depends only on its input arguments, or is affected by outside factors.

# Accessors

# commentData

get commentData(): JSONData | undefined

Inherited from MaterializedView.commentData

Defined in src/pg-structure/base/db-object.ts:102

Data which is extracted from database object's comment. Data is extracted from text between special case-insesitive tag (default: [pg-structure][/pg-structure]) and converted to JavaScript object using JSON5. Token name can be specified by using commentDataToken arguments. For details of JSON5, see it's web site: https://json5.org.

# 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: JSONData | undefined

# commentWithoutData

get commentWithoutData(): string | undefined

Inherited from MaterializedView.commentWithoutData

Defined in src/pg-structure/base/db-object.ts:85

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: string | undefined

# db

get db(): Db

Inherited from MaterializedView.db

Defined in src/pg-structure/base/db-object.ts:68

Database of the database object.

Returns: Db

# fullCatalogName

get fullCatalogName(): string

Inherited from MaterializedView.fullCatalogName

Defined in src/pg-structure/base/db-object.ts:35

Full name of the database object including database name.

Returns: string

# fullName

get fullName(): string

Overrides Constraint.fullName

Defined in src/pg-structure/base/func.ts:158

Full name of the object with '.' notation including Schema name.

# Example

const fullName = func.fullName; // public.some_func

Returns: string

# nameCaseType

get nameCaseType(): CaseType

Inherited from MaterializedView.nameCaseType

Defined in src/pg-structure/base/db-object.ts:54

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

# separator

get separator(): string

Inherited from MaterializedView.separator

Defined in src/pg-structure/base/db-object.ts:61

Separator used in database object name. Empty string for came case and underscore for (_) snake case.

Returns: string