# Pastebin EqJEdyeE raku -I. -MRed -e ' use Physics::Measure :ALL; my $*RED-DEBUG = True; red-defaults "SQLite"; model Log { has UInt $.id is serial; has Mass $.mass is column{ :deflate(*.in("kg").value), :inflate{ Mass.new: :value(.Real), :units } } } schema(Log).create; Log.^create: :mass(10000g); .mass.say for Log.^all ' SQL : BEGIN BIND: [] SQL : CREATE TABLE "log" ( id integer NOT NULL primary key AUTOINCREMENT, mass varchar(255) NOT NULL ) BIND: [] SQL : COMMIT BIND: [] SQL : BEGIN BIND: [] SQL : INSERT INTO "log"( mass ) VALUES( ? ) BIND: [10.0] SQL : SELECT "log".id , "log".mass FROM "log" WHERE _rowid_ = last_insert_rowid() LIMIT 1 BIND: [] SQL : SELECT "log".id , "log".mass FROM "log" WHERE "log".id = 1 LIMIT 1 BIND: [] SQL : COMMIT BIND: [] SQL : SELECT "log".id , "log".mass FROM "log" BIND: [] 10kg