Open
Conversation
Adds a new ORM plugin with support for SQLite, casting, and relations. Includes BaseModel, GamanORM, and provider implementations.
Refactors relation methods in BaseModel to correctly handle asynchronous operations and pass necessary parameters. Updates type definitions and tests to reflect these changes.
Includes refactored type definitions, updated tests, and enhanced TypeScript support.
Contributor
|
lagi demam pr |
Contributor
Author
Siapa sangka aowkkw |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gaman ORM Plugin
The Gaman ORM Plugin provides a lightweight Object-Relational Mapping (ORM) system for Gaman applications. It supports basic CRUD operations, automatic data type casting, and model relations through a provider-based architecture.
Features
Installation
The ORM plugin is part of the Gaman ecosystem. Ensure you have Gaman installed and include the ORM plugin in your project dependencies.
Setup
BaseModel:Usage
Basic CRUD Operations
Create
Read
Update
Delete
Data Casting
The ORM automatically casts data types based on the
castsoption in your model:intorinteger: Converts to numberfloatordouble: Converts to numberstring: Converts to stringboolorboolean: Converts to booleanjson: Parses JSON string or keeps as objectdatetime: Converts to Date objectRelations
hasMany
belongsTo
hasOne
Providers
SQLite Provider
The SQLite provider uses
sqlite3andsqlitepackages. It connects to adata.dbfile in the current directory.Example Application
Here's a complete example:
Notes
For more advanced usage, refer to the source code in
index.ts,orm.ts, andmodel/base.ts.