Please see the example class below.
DB.mapping are awesome. They make it easy to get data:
from class instance to json
from json to class instance
from db to class instance
from class instance to db
Is there an easy way to insert a new row into the database (postgres) when I have a class instance. One can assume that the set of property names matches with the column names in the DB table.
class Dog JSON.mapping( name: String, age: Int32, color: String? ) DB.mapping( name: String, age: Int32, color: String? ) property name = "FatTire" property age = 10 property color def initialize() end end