即使用户ID需要额外的工作,我也应该使用用户ID代替用户名吗? [英] Should I use a user's id instead of username even when user id requires extra work?

查看:131
本文介绍了即使用户ID需要额外的工作,我也应该使用用户ID代替用户名吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Skype制作一个机器人,该机器人将作为一款大型的基于zork的基于文本的游戏的旁白.
在我的用户"表中,我有user_id和username等,但是这个user_id是我自己生成的.最后,用户名始终是我必须用来查找用户的user_id的用户名,因为聊天程序中的每条消息只能给我该人的用户名,而不是我自己发明的user_id.

这意味着每次我想修改表中的用户数据时,都必须使用用户名来查找用户的ID,这是因为在许多表中唯一提到的是user_id而不是用户名.

我的问题是,当然,我应该跳过所有这些user_id废话而只使用用户名吗?

I am making a bot for Skype which will operate as a narrator to a huge zork-like text-based game.

In my "users" table, I have user_id and username and so forth, but this user_id is something I have generated myself. In the end, the username is always the one that I will have to use to find the user_id of a user since every message in the chat program can only give me the username of that person and not the user_id that I have invented myself.

This means that every time I want to modify a users data in a table I have to use the username to find the user''s id, and I do this because the user_id is the only thing mentioned in many of my tables rather than the username.

My question is of course, should I skip all this user_id crap and just use the username?

推荐答案

用户名唯一时,您可以将其用作密钥您的数据库.您将不允许在数据库中使用双用户名.

但是我不认为你会那样.
When the username is unique, you can use it as a key in your database. You won''t be allowed to have a double username in your database.

But i don''t think you wan''t that.


这篇关于即使用户ID需要额外的工作,我也应该使用用户ID代替用户名吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆