gf
gf copied to clipboard
gf gen:希望增加根据表自动生常用的CRUD功能
Is your feature request related to a problem?
Option Yes
Describe the solution you'd like
1、希望增加根据表自动生常用的CRUD功能 2、希望可以通过API文件生成对应的接口和服务。 3、希望加密方式加入 Bcrypt 加密方式。
Describe alternatives you've considered
暂时没想过,唯一想到的可能性是自己写生成器实现。
Additional
No response
bcrypt官方库就支持吧,我现在是这样做的
// PasswordHash 密码加密
func (s sPassword) PasswordHash(passwd string) (string, error) {
bytes, err := bcrypt.GenerateFromPassword([]byte(passwd), 10)
return string(bytes), err
}
// PasswordVerify 加密密码验证
func (s sPassword) PasswordVerify(passwd, hash string) bool {
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(passwd))
return err == nil
}
bcrypt官方库就支持吧,我现在是这样做的
// PasswordHash 密码加密 func (s sPassword) PasswordHash(passwd string) (string, error) { bytes, err := bcrypt.GenerateFromPassword([]byte(passwd), 10) return string(bytes), err } // PasswordVerify 加密密码验证 func (s sPassword) PasswordVerify(passwd, hash string) bool { err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(passwd)) return err == nil }
谢谢,我研究一下。
希望官方考虑一下1,2需求。