replace pasta.id == id to lambda function alias_comparator for better code reuse.
add custom_alias field in database
Why replace pasta.id == id
There are a large number of statements in the code that compare pasta.id == id, and implementing custom url inevitably introduces additional fields, requiring a large number of duplicate judgments to be written at all positions. Therefore, I choose to extract the comparison logic into a lambda function to reduce duplicate code.
Other
There are many changes, and there may be cases that are not covered.
Support #83
What changed
MICROBIN_ENABLE_CUSTOM_URL
argument, default: falsepasta.id == id
to lambda functionalias_comparator
for better code reuse.custom_alias
field in databaseWhy replace
pasta.id == id
There are a large number of statements in the code that compare
pasta.id == id
, and implementing custom url inevitably introduces additional fields, requiring a large number of duplicate judgments to be written at all positions. Therefore, I choose to extract the comparison logic into a lambda function to reduce duplicate code.Other
Todo