struct DynFork::Migration::ModelState

Overview

To control the state of Models in the super collection.

Included Modules

Defined in:

dynfork/migration.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(collection_name : String, field_name_and_type_list : Hash(String, String), data_dynamic_fields : Hash(String, String), model_exists : Bool = false) #

[View source]
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)

[View source]

Class Method Detail

def self.from_bson(bson : BSON) #

NOTE See self.new.


[View source]

Instance Method Detail

def collection_name : String #

[View source]
def data_dynamic_fields : Hash(String, String) #

[View source]
def data_dynamic_fields=(data_dynamic_fields : Hash(String, String)) #

[View source]
def field_name_and_type_list : Hash(String, String) #

[View source]
def field_name_and_type_list=(field_name_and_type_list : Hash(String, String)) #

[View source]
def model_exists=(model_exists : Bool) #

[View source]
def model_exists? : Bool #

[View source]
def to_bson(bson = BSON.new) #

Converts to a BSON representation.

user = User.new name: "John"
bson = user.to_bson

[View source]