dynfork
Version, currently 0.8.2679 versions
- 0.8.26latestMar 6, 2025
- 0.8.25not indexedMar 6, 2025
- 0.8.24not indexedMar 6, 2025
- 0.8.23not indexedMar 6, 2025
- 0.8.22not indexedMar 6, 2025
- 0.8.21not indexedMar 6, 2025
- 0.8.20not indexedMar 6, 2025
- 0.8.19not indexedMar 6, 2025
- 0.8.18not indexedMar 6, 2025
- 0.8.17not indexedMar 6, 2025
- 0.8.16not indexedMar 6, 2025
- 0.8.15not indexedMar 6, 2025
- 0.8.14not indexedMar 6, 2025
- 0.8.13not indexedMar 6, 2025
- 0.8.12not indexedMar 6, 2025
- 0.8.11not indexedMar 6, 2025
- 0.8.10not indexedMar 6, 2025
- 0.8.9not indexedMar 6, 2025
- 0.8.8not indexedMar 6, 2025
- 0.8.7not indexedMar 6, 2025
- 0.8.6not indexedMar 6, 2025
- 0.8.5not indexedMar 6, 2025
- 0.8.4not indexedMar 6, 2025
- 0.8.3not indexedMar 6, 2025
- 0.8.2not indexedMar 6, 2025
- 0.8.1not indexedMar 6, 2025
- 0.8.0not indexedMar 6, 2025
- 0.7.39not indexedMar 6, 2025
- 0.7.38not indexedMar 6, 2025
- 0.7.37not indexedMar 6, 2025
- 0.7.36not indexedMar 6, 2025
- 0.7.35not indexedMar 6, 2025
- 0.7.34not indexedMar 6, 2025
- 0.7.33not indexedMar 6, 2025
- 0.7.32not indexedMar 6, 2025
- 0.7.31not indexedMar 6, 2025
- 0.7.30not indexedMar 6, 2025
- 0.7.29not indexedMar 6, 2025
- 0.7.28not indexedMar 6, 2025
- 0.7.27not indexedMar 6, 2025
- 0.7.26not indexedMar 6, 2025
- 0.7.25not indexedMar 6, 2025
- 0.7.24not indexedMar 6, 2025
- 0.7.23not indexedMar 6, 2025
- 0.7.22not indexedMar 6, 2025
- 0.7.21not indexedMar 6, 2025
- 0.7.20not indexedMar 6, 2025
- 0.7.19not indexedMar 6, 2025
- 0.7.18not indexedMar 6, 2025
- 0.7.17not indexedMar 6, 2025
- 0.7.16not indexedMar 6, 2025
- 0.7.15not indexedMar 6, 2025
- 0.7.14not indexedMar 6, 2025
- 0.7.13not indexedMar 6, 2025
- 0.7.12not indexedMar 6, 2025
- 0.7.11not indexedMar 6, 2025
- 0.7.10not indexedMar 6, 2025
- 0.7.9not indexedMar 6, 2025
- 0.7.8not indexedMar 6, 2025
- 0.7.7not indexedMar 6, 2025
- 0.7.6not indexedMar 6, 2025
- 0.7.5not indexedMar 6, 2025
- 0.7.4not indexedMar 6, 2025
- 0.7.3not indexedMar 6, 2025
- 0.7.2not indexedMar 6, 2025
- 0.7.1not indexedMar 6, 2025
- 0.7.0not indexedMar 6, 2025
- 0.6.2not indexedMar 6, 2025
- 0.6.1not indexedMar 6, 2025
- 0.6.0not indexedMar 6, 2025
- 0.5.4not indexedMar 6, 2025
- 0.5.3not indexedMar 6, 2025
- 0.5.2not indexedMar 6, 2025
- 0.5.1not indexedMar 6, 2025
- 0.5.0not indexedMar 6, 2025
- 0.4.0not indexedMar 6, 2025
- 0.3.1not indexedMar 6, 2025
- 0.3.0not indexedMar 6, 2025
- 0.2.0not indexedMar 6, 2025
github.com/kebasyaty/dynfork
ORM-like API MongoDB for Crystal language.
7 stars
1 dependent
License: MIT
Installation
# Add this to your shard.yml
dependencies:
dynfork:
github: kebasyaty/dynfork
version: ~> 0.8.26Then run:
shards installshard.yml
- Crystal
>= 1.14.0, < 2.0- License
- MIT
- Author
- Gennady Kostyunin
Dependencies
Runtime Dependencies
- i18n~> 0.2.2github: crystal-i18n/i18n
- pluto~> 1.0.1github: phenopolis/pluto
- webslug*github: iomcr/webslug
- cryomongo~> 0.3.12github: elbywan/cryomongo
- validator~> 1.11.0github: nicolab/crystal-validator
Development Dependencies
- ameba*github: crystal-ameba/amebadev
README
Compatible with MongoDB 3.6+. Tested against: 7.0, 8.0 For more information see Cryomongo.
Documentation
Online browsable documentation is available at https://kebasyaty.github.io/dynfork/.
Requirements
View the list of requirements.
Installation
-
Add the dependency to your
shard.yml:dependencies: dynfork: github: kebasyaty/dynfork -
Run
shards install
Usage
It is recommended to look at examples here.
require "dynfork"
# Create your model.
@[DynFork::Meta(service_name: "Accounts")]
struct User < DynFork::Model
getter username = DynFork::Fields::TextField.new
getter email = DynFork::Fields::EmailField.new
getter birthday = DynFork::Fields::DateField.new
end
# Initialize locale.
# https://github.com/crystal-i18n/i18n
I18n.config.loaders << I18n::Loader::YAML.new("config/locales")
I18n.config.default_locale = :en
I18n.init
# Run migration.
# https://elbywan.github.io/cryomongo/Mongo/Client.html
DynFork::Migration::Monitor.new(
database_name: "test",
).migrat
# Create a user.
user = User.new
# Add user data.
user.username.value = "username"
user.email.value = "user@noreaply.net"
user.birthday.value = "1970-01-01"
# Save user.
# Hint: print_err - convenient for development.
user.print_err unless user.save
# Print user details.
puts "User details:"
if id = user.object_id
pp User.find_one_to_hash({_id: id})
end
puts "Documwnt count: #{User.estimated_document_count}"
puts "Delete user."
user.delete
puts "Documwnt count: #{User.count_documents}"
See more examples here.
Model Parameters
See the documentation here.
( only service_name is a required parameter )
Example:
@[DynFork::Meta(
service_name: "ServiceName",
fixture_name: "FixtureName",
db_query_docs_limit: 1000,
migrat_model?: true,
create_doc?: true,
update_doc?: true,
delete_doc?: true,
)]
struct User < DynFork::Model
getter username = DynFork::Fields::TextField.new
getter birthday = DynFork::Fields::DateField.new
end
Methods for developers
Links to documentation.
- full_model_name
- meta
- subclasses
- object_id
- add_validation
- indexing
- pre_create
- post_create
- pre_update
- post_update
- pre_delete
- post_delete
- migrat
- valid?
- save
- print_err
- delete
- verify_password
- update_password
- aggregate
- collection_name
- count_documents
- distinct
- estimated_document_count
- stats
- find_many_to_hash_list
- find_many_to_json
- find_one_to_hash
- find_one_to_instance
- find_one_to_json
- find_one_and_delete
- unit_manager
- delete_many
- delete_one
- bulk
- bulk_write
- create_index
- create_indexes
- drop_index
- drop_indexes
- list_indexes
- finance_plus
- finance_minus
- finance_divide
- finance_multiply
For currencies, use the Money shard.
Contributing
- Fork it (https://github.com/kebasyaty/dynfork/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- kebasyaty Gennady Kostyunin - creator and maintainer
Changelog
License
This project is licensed under the MIT.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.8.26- Tagged
- Mar 6, 2025
- Commit
3c44dca6810f- Crystal
>= 1.14.0, < 2.0- Indexed
- yes
Dependents
Repository
github.com/kebasyaty/dynfork
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 79