struct DynFork::Globals::Types::FileData
- DynFork::Globals::Types::FileData
- Struct
- Value
- Object
Overview
Data type for FileField
.
Included Modules
- BSON::Serializable
- JSON::Serializable
Defined in:
dynfork/globals/types.crConstructors
- .new(pull : JSON::PullParser)
-
.new(bson : BSON)
Allocate an instance and copies data from a BSON struct.
- .new
Class Method Summary
-
.from_bson(bson : BSON)
NOTE See
self.new
.
Instance Method Summary
-
#delete=(delete : Bool)
If the file needs to be deleted: delete=true.
-
#delete? : Bool
If the file needs to be deleted: delete=true.
-
#extension : String
File extension.
-
#extension=(extension : String)
File extension.
-
#name : String
Original file name.
-
#name=(name : String)
Original file name.
-
#new_file_data=(new_file_data : Bool)
A sign of a new file.
-
#new_file_data? : Bool
A sign of a new file.
-
#path : String
Path to file.
-
#path=(path : String)
Path to file.
-
#size : Int64
File size in bytes.
-
#size=(size : Int64)
File size in bytes.
-
#to_bson(bson = BSON.new)
Converts to a BSON representation.
-
#url : String
URL to file.
-
#url=(url : String)
URL to file.
Constructor Detail
def self.new(bson : BSON)
#
Allocate an instance and copies data from a BSON struct.
class User
include BSON::Serializable
property name : String
end
data = BSON.new
data["name"] = "John"
User.new(data)
Class Method Detail
Instance Method Detail
def delete=(delete : Bool)
#
If the file needs to be deleted: delete=true.
NOTE By default: delete=false.
def new_file_data=(new_file_data : Bool)
#
A sign of a new file.
NOTE true - if there is no file in the database.
def to_bson(bson = BSON.new)
#
Converts to a BSON representation.
user = User.new name: "John"
bson = user.to_bson