annotation DynFork::Meta

Overview

Model parameters:
( only service_name is a required parameter )

Parameter Default Description
service_name no Examples: Accounts | Smartphones | Washing machines | etc ...
fixture_name no The name of the fixture in the config/fixtures directory (without extension).
Examples: SiteSettings | AppSettings | etc ...
db_query_docs_limit 1000 limiting query results.
migrat_model? true Set to false if you do not need to migrate the Model to the database.
This can be use to validate a web forms - Search form, Contact form, etc.
create_doc? true Can a Model create new documents in a collection?
Set to false if you only need one document in the collection and the Model is using a fixture.
update_doc? true Can a Model update documents in a collection?
delete_doc? true Can a Model remove documents from a collection?

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

Defined in:

dynfork/meta.cr