Sync info from 3rd-party if possible.

This commit is contained in:
Yang Luo
2021-04-27 19:35:40 +08:00
parent 6002395d12
commit c317d601a5
2 changed files with 17 additions and 1 deletions

View File

@ -142,7 +142,7 @@ func GetUserByField(organizationName string, field string, value string) *User {
}
}
func LinkUserAccount(user *User, field string, value string) bool {
func SetUserField(user *User, field string, value string) bool {
affected, err := adapter.engine.Table(user).ID(core.PK{user.Owner, user.Name}).Update(map[string]interface{}{field: value})
if err != nil {
panic(err)
@ -151,6 +151,10 @@ func LinkUserAccount(user *User, field string, value string) bool {
return affected != 0
}
func LinkUserAccount(user *User, field string, value string) bool {
return SetUserField(user, field, value)
}
func GetUserField(user *User, field string) string {
// https://socketloop.com/tutorials/golang-how-to-get-struct-field-and-value-by-name
u := reflect.ValueOf(user)