Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PrimaryKey

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

Hierarchy

Index

Properties

Optional Readonly comment

comment: undefined | string

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

Readonly index

index: Index

The @{link Index index}} supporting this constraint.

Readonly name

name: string

Name of the database object.

Readonly table

table: Table

Table which this constraint defined in.

Accessors

columns

  • get columns(): default<Column, "name", never, true>
  • IndexableArray of columns this {@link PrimaryKeyConstraint primary key constraint} has. Columns are in order they are defined in database.

    Returns default<Column, "name", never, true>

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. 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 undefined | null | string | number | boolean | JSONObject | JSONArray

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

db

  • get db(): Db
  • Database of the database object.

    Returns Db

fullCatalogName

  • get fullCatalogName(): string
  • Full name of the database object including database name.

    Returns string

fullName

  • get fullName(): string
  • Full name of the constraint including table name.

    Returns string

nameCaseType

  • 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

schema

  • Schema of the constraint's table defined in.

    Returns Schema

separator

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

    Returns string

Generated using TypeDoc