module DynFork::QPaladins::Tools
Overview
Tools - A set of additional auxiliary methods for Paladins.
Direct including types
Defined in:
dynfork/paladins/tools.crInstance Method Summary
-
#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.
-
#print_err : Nil
Printing errors to the console.
-
#refrash_fields(doc_bson : BSON) : Nil
Refrash field values after creating or updating a document.
-
#valid? : Bool
Check data validity.
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.
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?
def refrash_fields(doc_bson : BSON) : Nil
#
Refrash field values after creating or updating a document.
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