pg-structure / Sequence

# Class: Sequence

Class which represent a sequence. Provides attributes and methods for details of the sequence.

# Hierarchy

# Table of contents

# Properties

# Accessors

# Methods

# Properties

# columns

Readonly columns: default<Column, name, attributeNumber, true>

All columns of the entity as an {@link IndexableArray indexable array} ordered by same order they are defined in database entity.

# Example

const isAvailable  = table.columns.has('id');
const columnNames  = =>;
const column       = table.columns.get('user_id');
const name         =;

table.columns.forEach(column => console.log(;

name Entity#columns

Inherited from: Entity.columns

Defined in: pg-structure/base/entity.ts:53

# comment

Optional Readonly comment: undefined | string

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

Inherited from: Entity.comment

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

# name

Readonly name: string

Name of the database object.

Inherited from:

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

# oid

Readonly oid: number

Object identifier for the Entity

Inherited from: Entity.oid

Defined in: pg-structure/base/entity.ts:25

# schema

Readonly schema: Schema

Schema of the object.

Inherited from: Entity.schema

Defined in: pg-structure/base/entity.ts:38

# Accessors

# commentData

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: (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

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

db(): Db

Database of the database object.

Returns: Db

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

# fullCatalogName

fullCatalogName(): string

Full name of the database object including database name.

Returns: string

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

# fullName

fullName(): string

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

# Example

const fullName = entity.fullName; // public.member

Returns: string

Defined in: pg-structure/base/entity.ts:33

# nameCaseType

nameCaseType(): CaseType

Letter casing (i.e snakeCase or camelCase) of the database object name.

# Example

const name =;                        // ProductDetail
const caseType = entity.nameCaseType;            // camelCase

const otherEntity =;            // member_protocol
const otherCaseType = otherEntity.nameCaseType;  // snakeCase

Returns: CaseType

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

# separator

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

# Methods

# get

get(column: string): Column

Returns column with given name from entity.

# Example

const column = entity.get('contact'),  // Returns contact column from entity.

# Parameters:

Name Type
column string

Returns: Column

requested columns.

Inherited from: Entity

Defined in: pg-structure/base/entity.ts:67