{"id":27435578,"url":"https://github.com/hhuziuk/bonorm","last_synced_at":"2026-04-09T16:05:29.801Z","repository":{"id":207212694,"uuid":"708965895","full_name":"hhuziuk/bonORM","owner":"hhuziuk","description":"Object-relational mapping for TypeScript. Supports MySQL and PostgreSQL.","archived":false,"fork":false,"pushed_at":"2024-02-22T10:23:12.000Z","size":327,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-21T02:49:24.116Z","etag":null,"topics":["javascript","mysql","orm","postgresql","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/bonorm","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hhuziuk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-23T18:38:06.000Z","updated_at":"2024-11-21T16:05:22.000Z","dependencies_parsed_at":"2024-12-16T08:00:41.653Z","dependency_job_id":null,"html_url":"https://github.com/hhuziuk/bonORM","commit_stats":null,"previous_names":["hhuziuk/bonorm"],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/hhuziuk/bonORM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhuziuk%2FbonORM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhuziuk%2FbonORM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhuziuk%2FbonORM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhuziuk%2FbonORM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hhuziuk","download_url":"https://codeload.github.com/hhuziuk/bonORM/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhuziuk%2FbonORM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271657717,"owners_count":24797935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","mysql","orm","postgresql","typescript"],"created_at":"2025-04-14T18:50:13.480Z","updated_at":"2026-04-09T16:05:29.761Z","avatar_url":"https://github.com/hhuziuk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca name=\"readme-top\"\u003e\u003c/a\u003e\n# BonORM\n![BonORM](https://github.com/hhuziuk/bonORM/blob/main/logo.jpeg?raw=true)\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#about-the-project\"\u003eAbout The Project\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#built-with\"\u003eBuilt With\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#features\"\u003eFeatures\u003c/a\u003e\u003c/li\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#data-types\"\u003eData types\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#entities\"\u003eEntities\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#columns\"\u003eColumns\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#validation\"\u003eValidation\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#errors\"\u003eErrors\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#migrations\"\u003eMigrations\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#basic-operations\"\u003eBasic operations\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#relations\"\u003eRelations\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003cli\u003e\u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n## About The Project\n\nBonORM is my own implementation of an object-relational mapping (ORM) designed for use on the NodeJS platform and in projects developed using Typescript. I created this tool to ensure that users can use only the tools they need for their work, making the process of interacting with the database much easier and more enjoyable. BonORM makes it easy to interact with the database, providing efficient management of objects and their relationships so that your development is more productive.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n### Built With\n\nThis section describes the technologies and frameworks ORM can be used with.\n\n[![Technologies](https://skillicons.dev/icons?i=ts,postgres,mysql\u0026perline=5)](https://skillicons.dev)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- GETTING STARTED --\u003e\n## Getting Started\n### Installation\n\nHere you can get in touch with installation and basic setup guide\n\nFirstly, you should install a package from npm\n* npm (as a simple dependency)\n  ```sh\n  npm i bonorm\n  ```\n* npm (as a dev dependency)\n  ```sh\n  npm install bonorm --save-dev\n  ```\n\n### Environment file\nTo work with ORM you also should create `.env`file where you can place all your secrets and \ntype of database you want to work with.\n\nHere is example for your `.env` file:\n```gitignore\nDB_TYPE=postgres // type of database(mysql or postgres)!!!\nprocess.env.USER: 'user', // your username\nprocess.env.HOST=localhost  // name of your host\nprocess.env.DATABASE: 'database1', // name of your database\nprocess.env.PASSWORD: 'root', // password for your database\nprocess.env.PORT: 5432 // port which your database is running on\n```\n\n### Configuration files \n\nIf you want to get start with concrete database, you can generate a desirable configuration\n\n* Create configuartion file for MySQL\n  ```sh\n  npm run create:mySqlConfig \u003cpath\u003e \n  ```\n* Create configuartion file for PostgreSQL\n  ```sh\n  npm run create:pgConfig \u003cpath\u003e \n  ```\n* Your script block in package.json should look like this code snippet:\n  ```json\n  \"scripts\": {\n  \"create:pgConfig\": \"ts-node node_modules/bonorm/src/cli.ts create:pgConfig\",\n  \"create:mySqlConfig\": \"ts-node node_modules/bonorm/src/cli.ts create:mySqlConfig\"\n  }\n  ```\n* Also, to connect to the database you need to create a folder called `configs` in the working \ndirectory, and generate the config file there, here's how this process looks like:\n  ```sh\n  cd \u003cyour project name\u003e\n  mkdir configs\n  npm run create:pgConfig ./configs\n  ```\n* Then you need to provide all the necessary information about the database \nin place of the brackets:\n```ts\n// pgConfig.ts\nimport { Pool } from 'pg';\nexport const pgConfig = new Pool({\n      user: 'your data',\n      host: 'your data',\n      database: 'your data',\n      password: 'your data',\n      port: 5432,\n});\n```\n\n```ts\n// mySqlConfig.ts\nimport { Connection, createConnection } from 'mysql2/promise';\nconst mySqlConfig = () =\u003e {\n    return createConnection({\n        host: 'your data',\n        user: 'your data',\n        port: 'your port',\n        password: 'your data',\n        database: 'your data'\n    });\n};\nexport default mySqlConfig;\n```\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- FEATURES --\u003e\n## Features\n### Data types\nIn this section, you can learn more about the available data types that ORM works with.\nTo access a built-in data type, you must import a right module for your database:\n  ```ts\n  import { pgDataType } from \"bonorm\"; // for PostgreSQL types\n  import { mySqlDataType } from \"bonorm\"; // for MySQL types\n  ```\n* #### Numeric Types\n**for PostgreSQL:**\n  ```ts\n  pgDataType.Integer // signed four-byte integer\n  pgDataType.Float // single precision floating-point number (4 bytes)\n  pgDataType.SmallInt // signed two-byte integer\n  pgDataType.SmallSerial // autoincrementing two-byte integer\n  pgDataType.SmallSerial // autoincrementing four-byte integer\n  pgDataType.Double // double precision floating-point number (8 bytes)\n  ```\n**for MySQL:**\n  ```ts\n  mySqlDataType.Integer // whole number, signed\n  mySqlDataType.SmallInt // small integer, signed\n  mySqlDataType.Decimal // fixed-point number\n  mySqlDataType.Numeric // fixed-point number\n  mySqlDataType.Float // floating-point number (single precision)\n  mySqlDataType.Real // floating-point number (single precision)\n  mySqlDataType.BigInt // large integer, signed\n  ```\n* #### Text Types\n**for PostgreSQL:**\n  ```ts\n  pgDataType.String // variable-length character string\n  pgDataType.Text // variable-length character string\n  ```\n**for MySQL:**\n  ```ts\n  mySqlDataType.Char // fixed-length character string\n  mySqlDataType.Varchar // variable-length character string\n  mySqlDataType.Text // variable-length character string (large)\n  ```\n* #### Date/Time Types\n**for PostgreSQL:**\n  ```ts\n  pgDataType.Date // calendar date (year, month, day)\n  pgDataType.Timestamp // date and time (no time zone)\n  pgDataType.TimestampWithTimeZone // date and time, including time zone\n  pgDataType.Time // time of day (no date)\n  pgDataType.TimeWithTimeZone // time of day, including time zone\n  pgDataType.Interval // time interval\n  ```\n**for MySQL:**\n  ```ts\n  mySqlDataType.Date // calendar date (year, month, day)\n  mySqlDataType.Time // time of day\n  mySqlDataType.DateTime // date and time\n  mySqlDataType.Timestamp // date and time\n  ```\n* #### Binary Types\n**for PostgreSQL:**\n  ```ts\n pgDataType.Boolean // logical Boolean (true/false)\n  ```\n**for MySQL:**\n  ```ts\n  mySqlDataType.Binary // fixed-length binary string\n  mySqlDataType.Varbinary // variable-length binary string\n  mySqlDataType.Blob // binary large object\n  ```\n ### Specific Data Types\n* #### Network Address Types\n**for PostgreSQL:**\n  ```ts\n  pgDataType.Inet // IPv4 or IPv6 host address\n  ```\n* #### Text Search Types\n**for PostgreSQL:**\n  ```ts\n  pgDataType.TsQuery // text search query\n  pgDataType.TsVector // text search document\n  ```\n* #### Monetary Types\n**for PostgreSQL:**\n  ```ts\n  pgDataType.Money // currency amount\n  ```\n\n* #### UUID Type\n**for PostgreSQL:**\n  ```ts\n  pgDataType.UUID // universally unique identifier\n  ```\n**for MySQL:**\n  ```ts\n    mySqlDataType.UUID // universally unique identifier\n  ```\n\n* #### XML Type\n**for PostgreSQL:**\n  ```ts\n  pgDataType.XML // XML data\n  ```\n\n* #### JSON Types\n**for PostgreSQL:**\n  ```ts\n  pgDataType.Object // textual JSON data\n  pgDataType.ObjectB // binary JSON data, decomposed\n  ```\n* #### Spatial Data Types\n**for MySQL:**\n  ```ts\n    mySqlDataType.Geometry // geometric object\n    mySqlDataType.Point // geometric point\n    mySqlDataType.LineString // geometric line\n    mySqlDataType.Polygon // geometric polygon\n    mySqlDataType.MultiPoint // collection of points\n    mySqlDataType.MultiLineString // collection of lines\n    mySqlDataType.MultiPolygon // collection of polygons\n    mySqlDataType.GeometryCollection // collection of geometric objects\n  ```\n\n## Entities\nTo define your own entity, you need to use `@Entity(\"name for your table\")` decorator. After that, you need to use the Model class and pass the name of\nthe table to it as arguments and to define there columns with needed options. \nHere is an example:\n```ts\nimport {Column, pgDataType, Entity, Model} from \"bonorm\";\n@Entity(\"table1\")\nexport class table1 extends Model{\n    @PrimaryGeneratedColumn()\n    id: number\n    @Column({type: pgDataType.String})\n    name: string\n}\n```\n\n## Columns \n* ### `@Column()`\nCreates a default column where you can specify options.\n```ts\nimport {Column, pgDataType, Entity, Model} from \"bonorm\";\n@Entity(\"table1\")\nexport class table1 extends Model{\n    @Column({type: pgDataType.String})\n    name: string\n}\n```\n### Attributes\n* #### `type`\nEach attribute must be assigned a type, so you can use data types that already exist in `data-types`\n```ts\n@Column({type: pgDataType.String})\nname: string\n```\nFind more here: \u003ca href=\"#data-types\"\u003edata types\u003c/a\u003e\n* #### `unique`\nTo create an unique index you need to specify `{ unique: true }` in the attribute options\n```ts\n@Column({type: pgDataType.String, unique: false})\nname: string\n```\n* #### `allowNull`\nMakes column NULL or NOT NULL in the database. By default column is `{ allowNull: true }`.\n```ts\n@Column({type: pgDataType.String, allowNull: false})\nname: string\n```\n* #### `autoIncrement`\nIndicates whether the attribute should auto-increment\n* #### `defaultValue`\nThe `defaultValue` field in the context of creating a table model\nin the database indicates the default value for a particular attribute of this table.\nThis value will be used for new records if no specific value is specified for this\nattribute when inserting. Example: `{ defaultValue: 'Unknown' }`, `{ defaultValue: 0 }`.\n```ts\n@Column({type: pgDataType.String, nullable: true, defaultValue: \"Zalupenko\"})\n    vorname: string\n```\n\n\n* ### `@PrimaryColumn()`\nDefines a primary key column in an entity. It accepts an optional column type parameter, which defaults to `INTEGER` if not specified.\n```ts\nimport {Column, pgDataType, Entity, Model} from \"bonorm\";\n@Entity(\"table1\")\nexport class table1 extends Model{\n    @PrimaryColumn()\n    id: number\n}\n```\n### Attributes\n*  #### `\"uuid\"` - handles UUID generation based on the database type specified in the environment variables.\n```ts\n@PrimaryColumn(\"uuid\")\nid: string\n```\n\n* ### `@PrimaryGeneratedColumn()`\nDefines a primary column which value will be automatically generated with an auto-increment value.\n```ts\nimport { PrimaryGeneratedColumn, pgDataType, Entity, Model } from \"bonorm\";\n@Entity(\"table1\")\nexport class table1 extends Model{\n    @PrimaryGeneratedColumn()\n    id: number\n}\n```\n### Attributes\n*  #### `\"uuid\"` - handles UUID generation based on the database type specified in the environment variables.\n```ts\n@PrimaryGeneratedColumn(\"uuid\")\nid: string\n```\n\n\n\n### Usage example\nIn this code, a `Player` model is created with attributes `id` and `name`. \nThe `id` attribute is of type `integer`, `unique`, `not nullable`, and `auto-incremented`. \nThe `name` attribute is of type `string` and `unique`.\nAdditionally, the model-wide option of timestamps is set to true, indicating the inclusion of creation and update timestamps.\n\n```ts\nimport { Column, Entity, Model, pgDataType, PrimaryGeneratedColumn } from \"bonorm\";\nimport { IsEmail } from \"class-validator\";\n\n@Entity(\"Player13\")\nexport class Player13 extends Model {\n    @PrimaryGeneratedColumn()\n    id: number;\n\n    @Column({ type: pgDataType.String, unique: true })\n    name: string;\n\n    @Column({ type: pgDataType.String, default: () =\u003e \"Zalupenko\" }) // Setting a default value\n    surname: string;\n\n    @Column({ type: pgDataType.Boolean, default: true }) // Example of a boolean column with a default value\n    isActive: boolean;\n\n    @Column({ type: pgDataType.Boolean, default: false })\n    isAdmin: boolean;\n\n    @Column({ type: pgDataType.String, nullable: true }) // Example of a nullable column\n    notes: string;\n\n    @Column({ type: pgDataType.String, nullable: false })\n    @IsEmail()\n    email: string;\n}\n\n// Usage example\nconst examplePlayer = new Player13(\"Player13\");\n\nexamplePlayer.create({\n    name: \"Johny\",\n    surname: \"Doe\",\n    isActive: true,\n    isAdmin: false,\n    notes: \"This player prefers email communication.\",\n    email: \"john@example.com\"\n}, Player13);\n```\n\n## Validation\nIf you want to use validation in your entity you should use \u003ca href=\"#https://github.com/typestack/class-validator.git\"\u003e`class-validator`\u003c/a\u003e library.\nHere is a small example how you can use it:\n```ts\nimport { Column, Entity, Model, pgDataType, PrimaryGeneratedColumn } from \"bonorm\";\nimport { IsEmail, Length, Min } from \"class-validator\";\n\n@Entity(\"Player13\")\nexport class Player13 extends Model {\n    @PrimaryGeneratedColumn()\n    id: number;\n\n    @Column({ type: pgDataType.String, unique: true })\n    @Length(10, 20)\n    name: string;\n\n    @Column({ type: pgDataType.String, default: () =\u003e \"Zalupenko\" })\n    @Length(10, 20)\n    surname: string;\n\n    @Column({ type: pgDataType.String, nullable: true })\n    @Min(0)\n    notes: string;\n\n    @Column({ type: pgDataType.String, nullable: false })\n    @IsEmail()\n    email: string;\n    \n    @Column({ type: pgDataType.String, nullable: false })\n    @IsISBN()\n    isbn: string;\n}\n```\n\n## Errors\nThe `dbError` class is a custom error class extending the built-in Error class. \nIt is designed to handle various types of errors related to database operations.\nhere is a typical example of using the `dbError` class to check for the presence \nof a type in an attribute\n```ts\nif(!type) {\n  dbError.QueryError(`Type for attribute ${attribute} is undefined.`);\n}\n```\n\n* #### `ExistingDataError`\nThrows an error when attempting to insert data that already exists in the database.\n```ts\nstatic ExistingDataError(values: any[]);\n```\n* #### `ConnectionError`\nThrows an error when unable to connect to the database.\n```ts\nstatic ConnectionError();\n```\n* #### `QueryError`\nThrows an error when there is an issue with executing a database query.\n```ts\nstatic QueryError(message: any[] | string);\n```\n* #### `EmptyQuery`\nThrows an error when attempting to perform a database query with no data for insertion.\n```ts\nstatic EmptyQuery();\n```\n* #### `DbTypeError`\nThrows an error when user used invalid name of database.\n```ts\nstatic DbTypeError();\n```\n* #### `InvalidFormat`\nThrows an error when user provided invalid data format\n```ts\nstatic InvalidFormat()\n```\n\n\n## Migrations\nYou can also use the migration generator and additional tools to install and roll back migrations. You have two methods in migration file:\n`up`defines the changes that should be applied to the database schema when migrating up and `down`\nto revert the changes made by the `up` function.\nTo generate migrations, you need to add a few lines of code to the `\"scripts\"` area of the `package.json` file:\n```json\n\"scripts\": {\n    \"generate:migration\": \"ts-node node_modules/bonorm/src/cli.ts generate:migration \u003cpath to directory\u003e\",\n    \"up:migration\": \"ts-node node_modules/bonorm/src/cli.ts up:migration \u003cpath to file with generated migration\u003e\",\n    \"down:migration\": \"ts-node node_modules/bonorm/src/cli.ts down:migration \u003cpath to file with generated migration\u003e\"\n  }\n```\nHere is an example of a generated migration file named `MigrationV1700835172879.ts`:\n```ts\nimport {MigrationInterface, runQuery} from \"bonorm\"\nexport class ${fileName} implements MigrationInterface {\n    migrationName = '${fileName}';\n    public async up() {\n        // Your migration logic\n        await runQuery('CREATE TABLE IF NOT EXISTS example (id SERIAL PRIMARY KEY, name VARCHAR(255));');\n    }\n    public async down() {\n        // Your rollback logic\n        await runQuery('DROP TABLE IF EXISTS example;');\n    }\n}\nexport { ${fileName} as Migration };\n```\n## Basic operations\n\n* ### `create`\nThe `create` function designed to simplify the process of inserting new records into a specified database table.\nThis function supports asynchronous execution and returns a Promise that resolves to a QueryResult object.\n```ts\nplayerTable.create({name: 'Nazar'});\n```\n#### Arguments:\n* **`data(optional)`:**\nA JavaScript object representing the data to be inserted into \nthe database table. It should be in the form of key-value pairs, where keys correspond \nto column names and values represent the data to be inserted.\n#### Usage:\n```ts\nconst dbModel = new Model('Employers');\nconst newData = {\n  name: 'John Doe',\n  age: 30,\n  email: 'john.doe@example.com'\n};\nconst result = await dbModel.create(newData);\n```\n* ### `find`\nThe `find` function was designed\nto facilitate the retrieval of records from a specified database table based on specified criteria.\nThis function supports asynchronous execution and returns a Promise that resolves to a QueryResult object.\n#### Example:\n```ts\nconst dbModel = new Model('Employers');\nconst findResult = await dbModel.find({\n  select: ['id', 'name'],\n  where: { name: 'Example Team' },\n  order: { id: 'ASC' }\n});\n```\n#### Arguments:\n###### **options (required):**\n* **`select`:** An array of column names to be selected.\n* **`relations`:** An array of table names for LEFT JOIN operations.\n* **`where`:** A JavaScript object representing the conditions for the WHERE clause.\n* **`order`:** A JavaScript object representing the order criteria.\n* **`skip`:** The number of records to skip (for pagination).\n* **`take`:** The maximum number of records to retrieve.\n\n#### Example:\n```ts\nconst dbModel = new Model('Employers');\nconst findResult = await dbModel.find({\n    select: ['id', 'name'],\n    relations: ['relatedTable'],\n    where: { name: 'Example Team' },\n    order: { id: 'ASC' },\n    take: 1\n});\n```\n\n* ### `findOne`\nThe `findOne` function was designed to retrieve a single record from a specified database table based on specified criteria.\nThis function supports asynchronous execution and returns a Promise that resolves to a QueryResult object.\n#### Arguments:\n###### **options (required):**\n* **`where`:** A JavaScript object representing the conditions for the WHERE clause.\n#### Example:\n```ts\nconst data = await playerTable.find({\n    where: { name: \"Nazar\" }\n});\n```\n\n* ### `save`\nThe `save` function was designed for updating existing records in a specified database table.\nThis function supports asynchronous execution and returns a Promise that resolves to a QueryResult object.\n#### Example:\n```ts\nconst dbModel = new Model('Employers');\nconst saveResult = await dbModel.save();\n```\n\n* ### `delete`\nThe `delete` function was designed to simplify\nthe process of removing records from a specified database table. This function supports asynchronous execution\nand returns a Promise that resolves to a QueryResult object.\n\n#### Arguments:\n###### **options (required):**\n* **`where:`** A JavaScript object representing the conditions for the WHERE clause.\n#### Example:\n```ts\nconst dbModel = new Model('Employers');\nconst deleteResult = await dbModel.delete({\n  where: { id: 123 }\n});\n```\n\n## Relations\nORM also makes it possible to create relations between databases. \nRelations help you to work with related entities easily. \nThere are several types of relationships:\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"#one-to-one\"\u003eOne-To-One\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#one-to-many\"\u003eOne-To-Many\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#many-to-many\"\u003eMany-To-Many\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n* ### `One-To-One`\nIn a one-to-one relationship, each record in one table is associated with exactly one \nrecord in another table, and vice versa. This is achieved by having a foreign key in one table \nthat references the primary key of the other table.\n#### Arguments\n```ts\ncreateOneToManyRelation(\"tableName\", \"key\", \"referenceTable\", \"referenceKey\");\n```\nWhere:\n\n_**tableName:**_ The name of the primary table where the one-to-one relationship is being created.\n\n_Example:_ `\"player\"`\n\n_**key:**_ The foreign key column to be added to the primary table `tableName` that references the related table's primary key.\n\n_Example:_ `\"teamId\"`\n\n_**referenceTable:**_ The name of the related table that forms the other side of the one-to-one relationship.\n\n_Example:_ `\"team\"`\n\n_**referenceTable:**_ The primary key column in the related table (`referenceTable`) that is being referenced by the foreign key in the primary table.\n\n_Example:_ `\"id\"`\n\n```ts\nimport { createOneToOneRelation } from \"bonorm\"\n\nconst playerTable = new Model('Player');\n// ...\nconst teamTable = new Model('Team');\n// ...\ncreateOneToOneRelation(\"player\", \"teamId\", \"team\", \"id\");\n```\nIn this example, a one-to-one relationship is established between the `\"Player\"` and `\"Team\"` tables. \nThe `\"player\"` table gets a foreign key column named `\"teamId\"` referencing the primary key `\"id\"` \nin the `\"team\"` table. This relationship implies that each player can be associated with one team, \nand each team can be associated with one player.\n\n* ### `One-To-Many`\nIn a one-to-many relationship, each record in the primary table can be associated with multiple \nrecords in the related table, but each record in the related table is associated with only one \nrecord in the primary table. This is typically implemented by having a foreign key in the related \ntable that refers to the primary key in the primary table.\n#### Arguments\n```ts\ncreateOneToManyRelation(\"tableName\", \"key\", \"referenceTable\", \"referenceKey\");\n```\nWhere:\n\n_**tableName:**_ The name of the primary table where the one-to-many relationship is being created.\n\n_Example:_ `\"player\"`\n\n_**key:**_ The foreign key column to be added to the primary table `tableName` that references the related table's primary key.\n\n_Example:_ `\"teamId\"`\n\n_**referenceTable:**_ The name of the related table that forms the other side of the one-to-many relationship.\n\n_Example:_ `\"team\"`\n\n_**referenceTable:**_ The primary key column in the related table (`referenceTable`) that is being referenced by the foreign key in the primary table.\n\n_Example:_ `\"id\"`\n\n```ts\nimport { createOneToManyRelation } from \"bonorm\"\n\nconst playerTable = new Model('Player');\n// ...\nconst teamTable = new Model('Team');\n// ...\ncreateOneToManyRelation(\"player\", \"teamId\", \"team\", \"id\");\n```\nIn the following example, a one-to-many relationship is established between the `\"Player\"` and \n`\"Team\"` tables. The primary table, \"player,\" gains a foreign key column named `\"teamId\"` which references \nthe primary key `\"id\"` in the related table `\"team\"`.\n\n* ### `Many-To-Many`\nIn a many-to-many relationship, each record in the primary table can be associated with multiple \nrecords in the related table, and vice versa. This relationship is typically implemented using an \nintermediate table that contains foreign keys referencing both primary tables.\n\n#### Arguments\n```ts\ncreateManyToManyRelation(\"tableName\", \"intermediateTableName\", \"referenceTable\");\n```\nWhere:\n\n_**tableName:**_ The name of the first primary table participating in the many-to-many relationship.\n\n_Example:_ `\"player\"`\n\n_**intermediateTableName:**_ The name of the intermediate table created to represent the many-to-many relationship.\n\n_Example:_ `\"playerTeam\"`\n\n_**referenceTable:**_ The name of the second primary table participating in the many-to-many relationship.\n\n_Example:_ `\"team\"`\n\n```ts\nimport { createManyToManyRelation } from \"bonorm\"\n\nconst playerTable = new Model('Player');\n// ...\nconst teamTable = new Model('Team');\n// ...\ncreateManyToManyRelation(\"player\", \"playerTeam\", \"team\");\n```\nIn this example, a many-to-many relationship is established between the `\"Player\"` and `\"Team\"` \ntables using the intermediate table `\"PlayerTeam\"` This allows each player to be associated with \nmultiple teams, and each team to be associated with multiple players. The createManyToManyRelation\nfunction is used to create the `\"PlayerTeam\"` table, which acts as a bridge between the `\"Player\"` \nand `\"Team\"` tables, facilitating the many-to-many relationship.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\u003c!-- CONTRIBUTING --\u003e\n## Contributing\n\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\nIf you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag \"enhancement\".\nDon't forget to give the project a star! Thanks again!\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/Features`)\n3. Commit your Changes (`git commit -m 'Add some Features'`)\n4. Push to the Branch (`git push origin feature/Features`)\n5. Open a Pull Request\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\u003c!-- LICENSE --\u003e\n## License\n\nDistributed under the MIT License. See `LICENSE.txt` for more information.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\u003c!-- CONTACT --\u003e\n## Contact\nHeorhii Huziuk - huziukwork@gmail.com\n\nWhy BonOrm?(it's like a word game with \u003ca href=\"https://en.wikipedia.org/wiki/Bono\"\u003eBono\u003c/a\u003e and ORM)\n\nProject link: [https://github.com/hhuziuk/bonORM.git](https://github.com/hhuziuk/bonORM.git)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhuziuk%2Fbonorm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhhuziuk%2Fbonorm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhuziuk%2Fbonorm/lists"}