Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

id should be stored as string-type. #1

Open
chhsiao1981 opened this issue Dec 16, 2020 · 1 comment
Open

id should be stored as string-type. #1

chhsiao1981 opened this issue Dec 16, 2020 · 1 comment

Comments

@chhsiao1981
Copy link

有決定說 article 也會有 id.
comments 很可能也會有 id. (而且也應該要有.)

這個年代的 id 存成 int 是很容易會碰到上限的限制~
需要把 id 存成 string-type.
由 db 來確保 id 的 uniqueness.

@tracyxxlee
Copy link
Collaborator

article / comment / user 不同類別的 Id 都是獨立的,不會互相干擾。

的確,id 存成 int 很容易會碰到上限的限制,
考量 id 應具唯一性,最好也具序列特性,便於排序;
如果有其他欄位可以決定新舊,則可以沒有序列性。

以目前 API 還是 proto type 的角度來說,資料量少,
int 是最簡單表達的型態。
正式制定資料欄位格式時,可再做調整。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants