Having used the AWS SDK, I feel your pain. They do have built-in helper
methods, e.g. https://docs.aws.amazon.com/sdk-for-go/api/aws/#String, so at
least you don't have to define your own.

Jim

On Wed, Apr 17, 2019 at 2:22 PM whitehexagon via golang-nuts <
golang-nuts@googlegroups.com> wrote:

> I'm still very new to Go, so apologies if this is obvious.  I'm porting
> some code over to Go, and the provided SDK I'm working with seems to want
> pointers everywhere.  However a lot of the values are constant / literals.
>
> So for example storing some data in the DB:
>
>
> https://docs.aws.amazon.com/sdk-for-go/api/service/simpledb/#PutAttributesInput
>
> My first thought was along the lines:
>
> field1 := ReplaceableAttribute{&"colA", &true, &"new value"}
> condition := UpdateCondition{&true, &"ColKey", &"Key"}
> input := PutAttributesInput{[]*ReplaceableAttribute{field1}, &"TABLE1",
> &condition", &"Key"}
>
> That was before reading a lot of historical debates about the merits of
> such syntax...  So assuming I dont want to create vars for every value, or
> helper functions, Is there a clean way of achieving the above?
> I can see that the API provides convenience setters for every struct
> attribute, but you can imagine it creates a lot of code bloat for quite
> simple functionality.  Any thoughts?
>
> Peter
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to