Facebook Graph API 2 - 存储在数据库中的用户 ID 类型

Facebook Graph API 2 - type of user ids when storing in database

有没有什么好的模式可以使用 Facebook Graph Api 2 将用户 _id 存储在数据库中?

这里有2个选项

  1. 双整数
  2. 可变字符

此外,如果我使用 varchar,它需要多长时间? 64?

简答: 使用 varchar(255)

长答案:

Facebook 声明您不应对从其 API 返回的 ID 的结构做出任何假设:

We specifically do not document any node/object ID structure or format because it is extremely likely to change over time and apps should not make assumptions based on current structure.

source

在营销 API 文档中,它说:

Each id returned in that API call should be considered opaque [...]

source

Facebook 的 Simon Cross states the following in the Facebook Developer Community group:

We don't have immediate plans to change to alphanumeric uids, but you MUST ensure you're storing them as bigints at the very least. Varchar 255 is the ideal format.

permalink