Integer provides access to an attribute of type Number. DynamoDB sends the values as strings. For convenience this method provides conversion to int. If the value cannot be represented by a signed integer, err.Err = ErrRange and the returned value is the maximum magnitude integer of an int64 of the
()
| 84 | // of an int64 of the appropriate sign. |
| 85 | // Method panics if the attribute is not of type Number. |
| 86 | func (av DynamoDBAttributeValue) Integer() (int64, error) { |
| 87 | number := av.Number() |
| 88 | value, err := av.Int64() |
| 89 | if err == nil { |
| 90 | return value, nil |
| 91 | } |
| 92 | s, err := strconv.ParseFloat(number, 64) |
| 93 | return int64(s), err |
| 94 | } |
| 95 | |
| 96 | // Float provides access to an attribute of type Number. |
| 97 | // DynamoDB sends the values as strings. For convenience this method |