Return the primary key field as a String
class Category
- Category
- Crecto::Model
- Reference
- Object
Included Modules
- Crecto::Schema
- Crecto::Schema::BelongsTo
- Crecto::Schema::HasMany
- Crecto::Schema::HasOne
- DB::Mappable
- JSON::Serializable
Extended Modules
- Crecto::Changeset(Category)
Defined in:
main.crConstant Summary
- 
        CRECTO_DESTROY_ASSOCIATIONS = Array(Symbol).new
- 
        CRECTO_ENUM_FIELDS = [] of NamedTuple(name: Symbol, type: String, column_name: String, column_type: String)
- 
        CRECTO_FIELDS = [{name: :categoryid, type: Int32}, {name: :categoryname, type: String}, {name: :categorydesc, type: String}] of NamedTuple(name: Symbol, type: String)
- 
        CRECTO_MODEL_FIELDS = [] of NamedTuple(name: Symbol, type: String)
- 
        CRECTO_NULLIFY_ASSOCIATIONS = Array(Symbol).new
- 
        CRECTO_VALID_FIELD_OPTIONS = [:primary_key, :virtual, :default]
- 
        CRECTO_VALID_FIELD_TYPES = [String, Int64, Int32, Int16, Float32, Float64, Bool, Time, Int32 | Int64, Float32 | Float64, Json, PkeyValue, Array(String), Array(Int64), Array(Int32), Array(Int16), Array(Float32), Array(Float64), Array(Bool), Array(Time), Array(Int32 | Int64), Array(Float32 | Float64), Array(Json), Array(PkeyValue)]
- 
        macro constants 
Constructors
Class Method Summary
- .add_destroy_association(a)
- .add_nullify_association(a)
- 
        .association_type_for_association(association : Symbol)
        
          Get the association type for the association i.e. 
- .cast(attributes : NamedTuple, whitelist : Tuple = attributes.keys)
- .cast(attributes : Hash(Symbol, T), whitelist : Array(Symbol) = attributes.keys) forall T
- .cast(attributes : Hash(String, T), whitelist : Array(String) = attributes.keys) forall T
- 
        .cast(**attributes)
        
          Class methods for mass assignment 
- .cast!(attributes : NamedTuple)
- 
        .cast!(**attributes : **T) forall T
        
          Class methods for compile-time type safe mass assignment 
- 
        .changeset_fields
        
          Class method to get the .changeset_fields
- .created_at_field
- .destroy_associations
- .fields
- 
        .foreign_key_for_association(association : Symbol) : Symbol | Nil
        
          Get the foreign key for the association i.e. 
- .foreign_key_for_association(klass : Crecto::Model.class)
- 
        .foreign_key_value_for_association(association : Symbol, item)
        
          Get the foreign key value from the relation object i.e. 
- .from_rs(__temp_200 : DB::ResultSet)
- 
        .klass_for_association(association : Symbol)
        
          Get the Class for the assocation name i.e. 
- .nullify_associations
- 
        .primary_key_field
        
          Return the primary key field as a String 
- 
        .primary_key_field_symbol
        
          Return the primary key field as a Symbol 
- 
        .set_value_for_association(association : Symbol, item, items)
        
          Set the value for the association i.e. 
- 
        .table_name
        
          Class method to get the table name 
- 
        .through_key_for_association(association : Symbol) : Symbol | Nil
        
          Get the through association symbol i.e. 
- .updated_at_field
- .use_primary_key?
- 
        .validate(message : String, block : Category -> _)
        
          Validates generic block against an instance of the class 
Instance Method Summary
- #cast(attributes : NamedTuple, whitelist : Tuple = attributes.keys)
- #cast(attributes : Hash(Symbol, T), whitelist : Array(Symbol) = attributes.keys) forall T
- #cast(attributes : Hash(String, T), whitelist : Array(String) = attributes.keys) forall T
- 
        #cast(**attributes : **T) forall T
        
          Empty instance methods for mass assignment Implementations are in the Schema.setup macro 
- #cast!(attributes : NamedTuple)
- 
        #cast!(**attributes : **T) forall T
        
          Instance method for compile-time type safe mass assignment 
- #categorydesc : String?
- #categorydesc!
- #categorydesc=(_categorydesc : String | Nil)
- #categoryid : Int32?
- 
        #categoryid!
        
          Builds fields' cast typed method 
- #categoryid=(_categoryid : Int32 | Nil)
- #categoryname : String?
- #categoryname!
- #categoryname=(_categoryname : String | Nil)
- #created_at : Time?
- #created_at=(_created_at : Time | Nil)
- #created_at_to_now
- #created_at_value
- #get_changeset
- #id : Int16 | Int32 | Int64 | Int8 | String | Nil
- #id=(_id : PkeyValue | Nil)
- 
        #initial_values : Hash(Symbol, DbValue) | Nil
        
          Instance properties 
- 
        #initial_values=(initial_values : Hash(Symbol, DbValue) | Nil)
        
          Instance properties 
- 
        #pkey_value
        
          Returns the value of the primary key field 
- #products : Array(Product)
- #products=(val : Array(Product))
- #products? : Array(Product) | Nil
- #to_h
- 
        #to_query_hash(include_virtual = false)
        
          Builds a hash from all CRECTO_FIELDSdefined
- #update_from_hash(hash : Hash(String, DbValue))
- #update_primary_key(val)
- #updated_at : Time?
- #updated_at=(_updated_at : Time | Nil)
- #updated_at_to_now
- #updated_at_value
Constructor Detail
Class Method Detail
Get the association type for the association i.e. :posts => :has_many
Class methods for compile-time type safe mass assignment
Get the foreign key for the association i.e. :posts => :user_id
Get the foreign key value from the relation object i.e. :posts, post => post.user_id
Get the Class for the assocation name i.e. :posts => Post
Set the value for the association i.e. :posts, user, [posts] => user.posts = [posts]
Get the through association symbol i.e. :posts => :user_posts (if has_many through)
Validates generic block against an instance of the class
Instance Method Detail
Empty instance methods for mass assignment Implementations are in the Schema.setup macro