module DynFork::QPaladins::Tools

Overview

Tools - A set of additional auxiliary methods for Paladins.

Direct including types

Defined in:

dynfork/paladins/tools.cr

Instance Method Summary

Instance Method Detail

def delete(sort = nil, fields = nil, bypass_document_validation : Bool | Nil = nil, write_concern : Mongo::WriteConcern | Nil = nil, collation : Mongo::Collation | Nil = nil, hint : String | Hash | NamedTuple | Nil = nil, max_time_ms : Int64 | Nil = nil, session : Mongo::Session::ClientSession | Nil = nil) : Nil #

Delete a document from a collection in a database.


[View source]
def print_err : Nil #

Printing errors to the console. Convenient to use during development.

Example:

@[DynFork::Meta(service_name: "Accounts")]
struct User < DynFork::Model
  getter username = DynFork::Fields::TextField.new
  getter birthday = DynFork::Fields::DateField.new
end

user = User.new
user.print_err unless user.valid?

[View source]
def refrash_fields(doc_bson : BSON) : Nil #

Refrash field values ​​after creating or updating a document.


[View source]
def valid? : Bool #

Check data validity.

NOTE the main use is to check data from web forms.

Example:

@[DynFork::Meta(service_name: "Accounts")]
struct User < DynFork::Model
  getter username = DynFork::Fields::TextField.new
  getter birthday = DynFork::Fields::DateField.new
end

user = User.new
if user.valid?
  # your code...
end

[View source]