posts-go/posts/2023-04-17-naming.md

14 lines
557 B
Markdown
Raw Normal View History

2023-04-17 09:11:55 +00:00
# Naming things
## Filename in storage (S3, ...)
Always have year, month, day in filename to easily sort it out.
If file is uploaded by user, add `user_id` in filename, or some other unique identifier depends on your business in which you require to upload.
Personally, I always add timestamp and extra data in filename to avoid duplicate.
Example filename: `yyyy/mm/dd/{user_id}-{timestamp}-{extra}.ext`
Be careful with `/`, too much nested folder is no good for backup (as they say, idk if true or not, but less folder mean less complicated to me).