Zum Hauptinhalt springen

TableMapping

Constructors

Constructor

new TableMapping(tableName, columns, options?): TableMapping

Parameters

tableName

string

columns

Record<string, MappedColumn>

options?
sync

string

Returns

TableMapping

Properties

options

options: object

sync

sync: string


tableName

tableName: string


columns

columns: Record<string, MappedColumn>

Methods

insert()

insert(docFile, connection): boolean

Inserts a record with data provided by docFile

Parameters

docFile

DocFile

connection

DBConnection

Returns

boolean

Memberof

TableMapping


exists()

exists(docFile, connection): boolean

Check if the specified docFile already exist in database

Parameters

docFile

DocFile

connection

DBConnection

Returns

boolean

True if exists, otherwise false

Memberof

TableMapping


update()

update(docFile, connection): boolean

Updates a record with data provided by docFile

Parameters

docFile

DocFile

connection

DBConnection

Returns

boolean

Memberof

TableMapping


delete()

delete(filter, connection): boolean

Deletes a record with data provided by docFile

Parameters

filter

any

connection

DBConnection

Returns

boolean

Memberof

TableMapping


select()

select(connection, filter, orderBy, columns): unknown[]

Parameters

connection

DBConnection

filter

any

orderBy

string

columns

string[]

Returns

unknown[]


sync()

sync(docFile, connection): boolean

Insert or updates a record in table by providing docFile

Parameters

docFile

DocFile

connection

DBConnection

Returns

boolean

True if successful, otherwise false

Memberof

TableMapping


insertStatement()

insertStatement(docFile): string

Returns a insert statement

Parameters

docFile

DocFile

Returns

string

the statement

Memberof

TableMapping


selectStatement()

selectStatement(instance, filter?, orderBy?, columns?): string

Returns a select statement

Parameters

instance

SelectBuilder

filter?

any

orderBy?

string

columns?

string[]

Returns

string

the statement

Memberof

TableMapping


updateStatement()

updateStatement(docFile, filter?): string

Returns a update statement

Parameters

docFile

DocFile

filter?

string

Returns

string

the statement

Memberof

TableMapping


deleteStatement()

deleteStatement(filter): string

Returns a delete statement

Parameters

filter

any

Returns

string

Memberof

TableMapping


whereStatement()

whereStatement(filter): string[]

Returns the filter condition by providing docFile data

Parameters

filter

any

Returns

string[]

Memberof

TableMapping


createStatement()

createStatement(): string

Returns a create table statement, containing all columns

Returns

string

Memberof

TableMapping


getDBColumns()

getDBColumns(): string[]

Returns all database columns as a string array

Returns

string[]

Memberof

TableMapping


map()

map(docFile, entryKeysOnly?, formatValue?): object[]

Returns an array of MappedColumn, containing column name and formatted value

Parameters

docFile

DocFile

entryKeysOnly?

boolean

formatValue?

boolean

Returns

object[]

Memberof

TableMapping