diff --git a/data.go b/data.go index 7caca77..2f715c8 100644 --- a/data.go +++ b/data.go @@ -6,12 +6,13 @@ import ( func StoreCode(code string, location int64, member_id int) bool { key := fmt.Sprintf("code:%d:%d", location, member_id) - - val_exists := db.Exists(key).Val() + already_set := db.Exists(key).Val() == 1 db.Set(key, code, 0) - val := db.Get(code).Val() - fmt.Println(val, val_exists) - - return false + return already_set +} + +func GetCode(location int64, member_id int) string { + key := fmt.Sprintf("code:%d:%d", location, member_id) + return db.Get(key).Val() }