Created
February 6, 2015 10:20
-
-
Save AlexJReid/7b907f58856ab8ae954e 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
AWSDynamoDBAttributeValue *dbav = [AWSDynamoDBAttributeValue new]; | |
dbav.S = _userID; | |
update.key = @{@"UserID": dbav}; | |
// can be boiled down to: | |
update.key = @{@"UserID": [AWSDynamoDBAttributeValue withString:_userID]}; | |
/* ----------------- */ | |
@interface AWSDynamoDBAttributeValue (Helpers) | |
+(AWSDynamoDBAttributeValue*) withNumber:(NSNumber*)value; | |
+(AWSDynamoDBAttributeValue*) withString:(NSString*)value; | |
@end | |
@implementation AWSDynamoDBAttributeValue (Helpers) | |
+(AWSDynamoDBAttributeValue*) withNumber:(NSNumber*)value { | |
AWSDynamoDBAttributeValue *dbav = [AWSDynamoDBAttributeValue new]; | |
dbav.N = [value stringValue]; | |
return dbav; | |
} | |
+(AWSDynamoDBAttributeValue*) withString:(NSString*)value { | |
AWSDynamoDBAttributeValue *dbav = [AWSDynamoDBAttributeValue new]; | |
dbav.S = value; | |
return dbav; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment