You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't understand at all what the proper use of defineClass is?
On the one site i think it's good to have the types of the table props. But is it then used if I do a db.table.add() ?
I mean as this example:
constaTableClass=Dexie.defineClass({name: String,status: [{prio: Number,code: String}]})db=newDexie('DexieDB')db.version(1).stores({newTable: "++id,name"});db.newTable.mapToClass(aTableClass);db.open();constnewEntry=newaTableClass()newEntry.status.prio=1db.newTable.add(newEntry)// would this fail below?db.newTable.add({extra: "test"})// and how about reading ? db.newTable.where("name").startsWithIgnoreCase("v").toArray(function(a){// would a be a class instance here?});
Could i reach that way something as "a" required prop for table.add() ?
Can Dexie.defineClass() be used also for default values?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I don't understand at all what the proper use of
defineClass
is?On the one site i think it's good to have the types of the table props. But is it then used if I do a
db.table.add()
?I mean as this example:
Could i reach that way something as "a"
required
prop fortable.add()
?Can
Dexie.defineClass()
be used also for default values?Thx in advance.
Beta Was this translation helpful? Give feedback.
All reactions