feat: extra field

main
sudo pacman -Syu 2023-04-04 17:25:22 +07:00
parent fd40abe3ff
commit 301cac1861
3 changed files with 24 additions and 1 deletions

View File

@ -32,7 +32,7 @@ lint:
format:
go install github.com/haunt98/gofimports/cmd/gofimports@latest
go install mvdan.cc/gofumpt@latest
gofimports -w --company github.com/make-go-great .
gofimports -w --company github.com/make-go-great,github.com/haunt98 .
gofumpt -w -extra .
gen:

View File

@ -97,6 +97,21 @@
[Business] time, data -&gt; convert to unix timestamp milliseconds -&gt; [Database] int64</pre
>
</div>
<h2>
<a
id="user-content-extra-field-for-extra-things"
class="anchor"
aria-hidden="true"
href="#extra-field-for-extra-things"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Extra field for extra things
</h2>
<p>
Create new column in database is scary, so I suggest avoid it if you can.
How to avoid, first design table with extra field. It is black hole, put
everything in there if you want.
</p>
<p>I always use MySQL json data type for extra field.</p>
<h2>
<a
id="user-content-use-index"

View File

@ -30,6 +30,14 @@ It looks like this:
[Business] time, data -> convert to unix timestamp milliseconds -> [Database] int64
```
## Extra field for extra things
Create new column in database is scary, so I suggest avoid it if you can.
How to avoid, first design table with extra field.
It is black hole, put everything in there if you want.
I always use MySQL json data type for extra field.
## Use index!!!
You should use index for faster query, but not too much.