Skip to content

Commit

Permalink
improved README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
KnockOutEZ committed Mar 20, 2024
1 parent 035d047 commit 5ea83ec
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
[![Package minified & gzipped size](https://badgen.net/bundlephobia/minzip/prest-client)](https://bundlephobia.com/package/prest-client)
[![Package dependency count](https://badgen.net/bundlephobia/dependency-count/reactprest-client)](https://bundlephobia.com/package/prest-client)

`prest-client` is a TypeScript/JavaScript library that provides a convenient interface for interacting with the [pRESTd](https://docs.prestd.com/) API. It allows you to perform various operations on your PostgreSQL database, including CRUD operations, filtering, joining tables, advanced queries and so on.

## Features

- **CRUD Operations**: Create, read, update, and delete data from your PostgreSQL database.
- **Filtering**: Apply various filters to your queries, such as `page`, `pageSize`, `select`, `filterEqual`, and more.
- **Function Operations**: Perform aggregate functions like `sum`, `avg`, `max`, `min`, `stdDev`, and `variance`.
- **Advanced Queries**: Utilize advanced query capabilities like `filterRange`, `join`, `textSearch`, and more.
- **Batch Operations**: Insert multiple rows into a table with a single operation.
- **TypeScript Support**: Written in TypeScript, providing type safety and better tooling support.

## Installation

This library is published in the NPM registry and can be installed using any compatible package manager.
Expand Down Expand Up @@ -34,10 +45,49 @@ This module has an UMD bundle available through JSDelivr and Unpkg CDNs.
</script>
```

## Usage

Here's a basic example of how to use prest-client:

```typescript
import { PrestApiClient, type PrestApiClientOptions } from 'prest-client';

const options: PrestApiClientOptions = {
base_url: envs.BASE_URL,
user_name: envs.USER_NAME,
password: envs.USER_PASSWORD,
database: envs.DATABASE_NAME,
};
const client = new PrestApiClient(options);

// Fetch users
const fetchUsers = async () => {
const response = await client.table('users').list().execute();
console.log(response);
};

// Insert data
const insertData = async () => {
const data = {
user_id: 1,
user_name: 'john doe',
};

const response = await client.table('users').insert(data).execute();
console.log(response);
};
```

For more examples, please refer to the [examples](./examples) directory in the repository.

## Documentation

[Documentation generated from source files by Typedoc](./docs/README.md).

## Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.

## License

Released under [MIT License](./LICENSE).

0 comments on commit 5ea83ec

Please sign in to comment.