class Ar2gostruct::Builder::ORM::QBS
Public Instance Methods
get_option(col)
click to toggle source
# File lib/ar2gostruct/builder/orm/qbs.rb 8 def get_option(col) 9 orm_option = [] 10 # primary key 11 if col.name == @klass.primary_key 12 orm_option << "pk" 13 end 14 # not null Constraint 15 unless col.null 16 orm_option << "notnull" 17 end 18 # default value 19 if col.default 20 orm_option << "default:'#{col.default}'" 21 end 22 # set timestamp 23 if col.name == "created_at" 24 orm_option << "created" 25 elsif col.name == "updated_at" 26 orm_option << "updated" 27 end 28 if orm_option.present? 29 return "qbs:\"#{orm_option.join(TAG_SEPARATOR)}\"" 30 else 31 return nil 32 end 33 end