Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • PgHelper

Index

Constructors

constructor

  • new PgHelper(pooConfig: PoolConfig, options?: Options): PgHelper
  • Parameters

    • pooConfig: PoolConfig
    • Optional options: Options

    Returns PgHelper

Properties

Private autoHump

autoHump: boolean

Private logger

logger: Logger

Private pooConfig

pooConfig: PoolConfig

Private pool

pool: Pool

Private returning

returning: boolean

Methods

delete

  • delete(params: SqlTempParams, options: DeleteOptions): Promise<QueryResult>
  • build delete sql

    Parameters

    • params: SqlTempParams
    • options: DeleteOptions

    Returns Promise<QueryResult>

getClient

  • getClient(): Promise<any>
  • get a poolClient

    Returns Promise<any>

getTransaction

  • getTransaction(): Promise<any>
  • get a transaction poolClient

    Returns Promise<any>

Private initPool

  • initPool(): void

insert

  • insert(params: Insert, options: InsertOptions): Promise<QueryResult>
  • build insert sql

    Parameters

    • params: Insert
    • options: InsertOptions

    Returns Promise<QueryResult>

runSql

  • runSql(sqlTemp: string, sqlParams?: SqlTempParams, options?: SqlOptions): Promise<QueryResult>
  • Parameters

    • sqlTemp: string

      the executed sql template

    • Optional sqlParams: SqlTempParams

      template parameters, the key of Object needs to correspond to the value of {params} in the SQL template one-to-one

    • Optional options: SqlOptions

    Returns Promise<QueryResult>

runTSql

  • runTSql(sqlTemps: TSqlTempParams[], options?: SqlOptions): Promise<QueryResult[]>
  • will auto commit or rollback

    Parameters

    • sqlTemps: TSqlTempParams[]
    • Optional options: SqlOptions

    Returns Promise<QueryResult[]>

select

  • select(params: SqlTempParams, options: SelectOptions): Promise<QueryResult>
  • build select sql

    Parameters

    • params: SqlTempParams
    • options: SelectOptions

    Returns Promise<QueryResult>

update

  • update(params: SqlTempParams, options: UpdateOptions): Promise<QueryResult>
  • build update sql

    Parameters

    • params: SqlTempParams
    • options: UpdateOptions

    Returns Promise<QueryResult>

Legend

  • Constructor
  • Method
  • Private property
  • Private method

Generated using TypeDoc