Closed ctm closed 3 months ago
I think pulling DieselNewType
from Nick
makes sense and all I need to do is make a DieselNewType
DieselNick
and then I'll have to write the glue to convert from DieselNick
to Nick
.
I did a bunch of this work of work on this earlier this evening. I'd like to be able to use &Nick
for inserts since inserting a Nick
is safe, but I haven't figured a nice way to be able to do so. Obviously, I can turn a &Nick
into a DieselNick
, but that requires a copy that I'd prefer to avoid on principle.
D'oh. I can just use Insertable
structs that use &str
but whose constructors only take Nick
s. Then as_ref
can be used to populate the structs.
Done and merged to master. I can't deploy from here, but it'll go out with the next deploy.
Deploying now.
Stop using
DieselNewType
onNick
.I'm adding
Nick
as the type for nicknames. The constructor is fairly strict and prevents Zalgoed text, as well as other things as nicknames. As such, nothing currently unacceptable can be used for logging in or creating accounts, which means the nicknames logged have to pass the constructor. However, if we tighten the rules, there will be nothing that will prevent us from pulling something out of the database that's not allowed, becauseDieselNewType
bypasses the constructor.So, instead of using
DieselNewType
, we need to implement the various Diesel traits ourselves and we also need to be sure that nothing breaks if we try to pull out data that can't be converted from theText
toNick
.