KyselyK
Kysely3y ago
Samuel

TINYINT convert to bool

hello, i am using kysely with a mysql dialect and i find myself in a situation where some fields in JSON are just 1 instead of being true is there any way to change this?
Solution
        typeCast(field, next) {
            if (field.type === 'TINY' && field.length === 1) {
                return field.string() === '1'
            } else {
                return next();
            }
        }

soultion was to use a typecast
Was this page helpful?