Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@qrvey/data-persistence
Advanced tools
![install size](https://packagephobia.com/badge?p=%40qrvey%2Fdata-persistence)
You can install the package using npm or yarn:
npm install @qrvey/data-persistence
Or with yarn:
yarn add @qrvey/data-persistence
This package has the following peer dependencies:
@aws-sdk/client-dynamodb
(v3.x) and @aws-sdk/lib-dynamodb
(v3.x) for interacting with DynamoDB.pg
(v8.x) and pg-format
(v1.x) for interacting with PostgreSQL databases.This class serves as the foundation for interacting with your database. It exposes methods for performing CRUD operations on entities (data objects).
create(entity: T)
: Creates a new entity in the database.findAll(options: IFindOptions)
: Retrieves all entities based on specified options, this function make an internal pagination to load all data.findItem (options: IFindOptions)
: Fetches a single entity by a specified filter.update(filters: IFilter[], data: Partial<T>)
: Updates entities matching the provided filters with the given data.remove(filters: IFilter[])
: Deletes entities that satisfy the specified filters.These methods assist in constructing filters, query indexes, and sorting criteria for use within your CRUD operations.
buildFilter(attribute: string, value: string, operator = 'EQUAL')
: Creates a filter object for a specific attribute.buildQueryIndex(indexName: string, columns: string[])
: Constructs a query index for efficient data retrieval.buildSort(column: string, direction: SortDirection)
: Generates a sorting object for ordering results.This interface defines the structure of a database table. It allows you to specify the table name, columns, and optional schema and pool usage.
static table: string | ITableName
: This property defines the name of the database table that the CrudService will interact with. It can be a simple string (e.g., "users") or an object implementing the ITableName interface (discussed later).
static columns: ITableColumns
: This property represents an array of column definitions for the table. It should conform to the ITableColumns interface (discussed later). Each column definition likely specifies details like column name, data type, and potentially constraints.
static usePool?: boolean = false
: This optional boolean property (defaulting to false) indicates whether to use a connection pool for database interactions. Setting it to true can improve performance for frequent queries.
static schema: string | null = null
: This optional string property allows specifying the schema name (if applicable) where the table resides. It can be a string (e.g., "public") or null if the default schema is used.
This library provides a set of filter operators for performing comparisons on entity attributes within your database. These operators allow you to construct filters for your CRUD operations.
The FilterOperator enum defines the following operators:
FAQs
![install size](https://packagephobia.com/badge?p=%40qrvey%2Fdata-persistence)
The npm package @qrvey/data-persistence receives a total of 643 weekly downloads. As such, @qrvey/data-persistence popularity was classified as not popular.
We found that @qrvey/data-persistence demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.