stretchr / sdk-go

Go SDK for Stretchr platform
7 stars 1 forks source link

Think about the standard `.At(path).DoSomething` approach #12

Closed matryer closed 11 years ago

matryer commented 11 years ago

Pros:

Cons:

tylerstillwater commented 11 years ago

If you've loaded a resource already, this approach makes it more difficult to save that resource back. You have to re-type/re-do the path. I suppose you could do resource.Path as the argument to At(), but that seems a bit ridiculous.

matryer commented 11 years ago

Tyler

I think we should add some helper methods to resources that takes away that pain a little.

tylerResource.Set("name", "Tyler")
err := tylerResource.Save(session)

That way, if people just need to quickly save a resource, they can do this. If they need something a little more advanced (like turning timestamps off for this particular resource), then they can use the advanced version:

Stretchr.At(tylerResource.ResourcePath()).WithStamps(false).Update()
matryer commented 11 years ago

Done.