2023-07-18 18:38:30 +00:00
|
|
|
<!doctype html>
|
2023-04-17 09:11:55 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<link
|
|
|
|
rel="stylesheet"
|
2024-06-18 03:31:06 +00:00
|
|
|
href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.6.1/github-markdown.min.css"
|
2023-04-17 09:11:55 +00:00
|
|
|
/>
|
|
|
|
<title>haunt98 posts</title>
|
|
|
|
</head>
|
|
|
|
<style>
|
|
|
|
.markdown-body {
|
|
|
|
box-sizing: border-box;
|
|
|
|
min-width: 200px;
|
|
|
|
max-width: 980px;
|
|
|
|
margin: 0 auto;
|
|
|
|
padding: 45px;
|
2024-03-01 10:11:20 +00:00
|
|
|
font-family:
|
|
|
|
Shantell Sans Normal,
|
|
|
|
Rec Mono Casual,
|
|
|
|
SF Pro,
|
|
|
|
Inter,
|
|
|
|
sans-serif;
|
|
|
|
font-weight: 500;
|
|
|
|
}
|
|
|
|
|
|
|
|
.markdown-body pre {
|
|
|
|
font-family:
|
|
|
|
Berkeley Mono,
|
|
|
|
IBM Plex Mono,
|
|
|
|
SF Mono,
|
|
|
|
Jetbrains Mono,
|
|
|
|
monospace;
|
2023-04-17 09:11:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 767px) {
|
|
|
|
.markdown-body {
|
|
|
|
padding: 15px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<body class="markdown-body">
|
2023-08-09 07:22:58 +00:00
|
|
|
<h2>
|
|
|
|
<a href="index.html"><code>~</code></a>
|
|
|
|
</h2>
|
2024-02-29 12:29:26 +00:00
|
|
|
<div class="markdown-heading">
|
|
|
|
<h1 class="heading-element">Naming things</h1>
|
2023-11-19 15:59:21 +00:00
|
|
|
<a
|
|
|
|
id="user-content-naming-things"
|
2024-03-08 08:12:41 +00:00
|
|
|
class="anchor"
|
2024-02-29 12:29:26 +00:00
|
|
|
aria-label="Permalink: Naming things"
|
2023-11-19 15:59:21 +00:00
|
|
|
href="#naming-things"
|
2024-02-29 12:29:26 +00:00
|
|
|
><span aria-hidden="true" class="octicon octicon-link"></span
|
|
|
|
></a>
|
|
|
|
</div>
|
|
|
|
<div class="markdown-heading">
|
|
|
|
<h2 class="heading-element">Filename in storage (S3, ...)</h2>
|
2023-11-19 15:59:21 +00:00
|
|
|
<a
|
|
|
|
id="user-content-filename-in-storage-s3-"
|
2024-03-08 08:12:41 +00:00
|
|
|
class="anchor"
|
2024-02-29 12:29:26 +00:00
|
|
|
aria-label="Permalink: Filename in storage (S3, ...)"
|
2023-11-19 15:59:21 +00:00
|
|
|
href="#filename-in-storage-s3-"
|
2024-02-29 12:29:26 +00:00
|
|
|
><span aria-hidden="true" class="octicon octicon-link"></span
|
|
|
|
></a>
|
|
|
|
</div>
|
2023-04-17 09:11:55 +00:00
|
|
|
<p>Always have year, month, day in filename to easily sort it out.</p>
|
|
|
|
<p>
|
|
|
|
If file is uploaded by user, add <code>user_id</code> in filename, or some
|
|
|
|
other unique identifier depends on your business in which you require to
|
|
|
|
upload.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
Personally, I always add timestamp and extra data in filename to avoid
|
|
|
|
duplicate.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
Example filename:
|
|
|
|
<code>yyyy/mm/dd/{user_id}-{timestamp}-{extra}.ext</code>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
Be careful with <code>/</code>, 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).
|
|
|
|
</p>
|
2024-02-29 12:29:26 +00:00
|
|
|
<div class="markdown-heading">
|
|
|
|
<h2 class="heading-element">Time variable</h2>
|
2023-11-19 15:59:21 +00:00
|
|
|
<a
|
|
|
|
id="user-content-time-variable"
|
2024-03-08 08:12:41 +00:00
|
|
|
class="anchor"
|
2024-02-29 12:29:26 +00:00
|
|
|
aria-label="Permalink: Time variable"
|
2023-11-19 15:59:21 +00:00
|
|
|
href="#time-variable"
|
2024-02-29 12:29:26 +00:00
|
|
|
><span aria-hidden="true" class="octicon octicon-link"></span
|
|
|
|
></a>
|
|
|
|
</div>
|
2023-06-15 19:21:12 +00:00
|
|
|
<p>Add time postfix to make sense.</p>
|
|
|
|
<p>Instead of <code>create_at</code>, use <code>create_at_ms</code>.</p>
|
2023-04-17 09:11:55 +00:00
|
|
|
|
|
|
|
<div>
|
|
|
|
Feel free to ask me via
|
|
|
|
<a href="mailto:hauvipapro+posts@gmail.com">email</a> or
|
2023-08-20 17:29:13 +00:00
|
|
|
<a rel="me" href="https://hachyderm.io/@haunguyen">Mastodon</a>.
|
|
|
|
<br />Source code is available on
|
2023-04-17 09:11:55 +00:00
|
|
|
<a href="https://github.com/haunt98/posts-go">GitHub</a>
|
2023-08-20 17:29:13 +00:00
|
|
|
<a href="https://codeberg.org/yoshie/posts-go">Codeberg</a>
|
|
|
|
<a href="https://git.sr.ht/~youngyoshie/posts-go">sourcehut</a>
|
|
|
|
<a href="https://gitea.treehouse.systems/yoshie/posts-go">Treehouse</a>
|
|
|
|
<a href="https://gitlab.com/youngyoshie/posts-go">GitLab</a>
|
2023-04-17 09:11:55 +00:00
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|