Untitled
unknown
golang
8 months ago
988 B
5
Indexable
package main import ( "context" "fmt" "time" ) // JobA - Determines if we should show premium offer based on premium status and location func showPremiumOffer(isPremium bool, isNearby bool) bool { return !isPremium && isNearby // Show offer to non-premium users who are nearby } // JobB - Checks if user has premium subscription func isUserPremium(userID string) bool { time.Sleep(time.Second) // Simulate API call return false } // JobC - Checks if user is within 2 miles radius func isUserIn2Miles(userID string) bool { time.Sleep(time.Second) // Simulate geolocation check return true } // JobD - Gets current user ID func currentUser() string { time.Sleep(time.Second) // Simulate auth check return "user123" } func main() { ctx := context.Background() // Define jobs, dependencies and compute. // Your implementation goes here: // - showPremiumOffer depends on isUserPremium and isUserIn2Miles // - both isUserPremium and isUserIn2Miles depend on currentUser }
Editor is loading...
Leave a Comment