Created
May 19, 2019 17:28
-
-
Save palash25/db16be4f9edb79e4e4568bf02f76ceb8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const ( | |
| USER_INDEX_VERSION = "1" | |
| RESPONSE_INDEX_VERSION = "2" | |
| ORGANIZATION_INDEX_VERSION = "1" | |
| ) | |
| func index_and_type(typ string, version string, org_id string) (string, string) { | |
| switch type { | |
| case "user": | |
| if version != "" { | |
| return fmt.Printf("user_v%s", version), "user" | |
| } | |
| else { | |
| return fmt.Printf("user_v%s", USER_INDEX_VERSION), "user" | |
| } | |
| case "org": | |
| if version != "" { | |
| return fmt.Printf("organization_v%s", version), "organization" | |
| } | |
| else { | |
| return fmt.Printf("organization_v%s", ORGANIZATION_INDEX_VERSION), "organization" | |
| } | |
| case "response": | |
| // Add org_id_digest = hashlib.md5(org_id.encode('utf-8')).hexdigest() | |
| if version != "" { | |
| return fmt.Printf("response_v%s", version), "response" | |
| } | |
| else { | |
| return fmt.Printf("response_v%s",RESPONSE_INDEX_VERSION), "response" | |
| } | |
| default: | |
| return nil, nil | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment