- Le plus récent
- Le plus de votes
- La plupart des commentaires
Hi, V2 of the SDK now provides a typed experience for all API enumeration fields. Rather than using a string literal value copied from the service API reference documentation, you can now use one of the concrete types found in the service client’s types package. The types package provides generated constants for the valid enumeration values that can be used for assignment or conditional testing whereas with V1 you needed to use string literals. So this allows better type checking and I think improves readability.
I'm by no means a Go expert, but I agree that s3Types.StorageClassStandard.Values() feels a bit weird. In V2, Values() expects a receiver of type StorageClass so calling (StorageClass).Values() doesn't work in Go as StorageClass is a type, not an "instance" of a type, and this also doesn't work as it would in C because Go doesn't support 'static' class methods like C does.
Since Values() is expecting a receiver of type StorageClass, you could actually pass any of the StorageClass types. I don't know I would recommend it, but since StorageType is of type string, you could also use:
s3Types.StorageClass("").Values()
or
const storageClass = s3Types.StorageClass("")
...
fmt.Println(storageClass.Values())
Contenus pertinents
- demandé il y a un mois
- demandé il y a un an
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans