Skip to content

Spanner - Allow set/get of com.google.cloud.spanner.Value #1838

Description

@sai-pullabhotla

Is it possible to add methods to respective interfaces and classes to get/set instances of com.google.cloud.spanner.Value in addition to the distinct types that are currently supported?

For example - ResultSet.getValue() and ValueBinder.to(Value v)

Activity

  1. added
    api: spannerIssues related to the Spanner API.
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    on Mar 30, 2017
  2. vkedia commented on Mar 31, 2017

    @vkedia

    @sai-pullabhotla Can you please describe you use case. Why do you need these methods?

  3. sai-pullabhotla commented on Apr 1, 2017

    @sai-pullabhotla
    Author

    @vkedia - the purpose is to have a generic way to set/get data using an interface or generic type. I'm in the process of developing a ORM framework similar to the one I did for Cloud Datastore (Catatumbo), and having these methods would help with mapping types defined in the domain model to Spanner and vice versa. See Mapper for more info on how the mapping was done in Catatumbo, hoping to do the same for Spanner and having these methods would help. I also see another issue, #1805, which appears to be similar to what I'm asking for.

    Moreover, the API already does this internally to convert the distinct types to Value objects, so just need to expose a public method. Snippet from ValueBinder is below:

      public R to(@Nullable String value) {
        return handle(Value.string(value));
      }
    
    
  4. vkedia commented on Apr 3, 2017

    @vkedia

    @sai-pullabhotla Thanks. This sounds interesting. So if we had a to(Value) you would still need to figure out what type of Value to create, right? So it is not complete generic?

  5. modified the milestone: Spanner GA on May 8, 2017
  6. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on May 30, 2017
  7. yihanzhen commented on Jan 11, 2018

    @yihanzhen
    Contributor

    The feature request is added to the backlog. The issue will be closed but is linked in the backlog and can continue to be used for comment and discussion.

  8. added a commit that references this issue on Dec 22, 2025
  9. added a commit that references this issue on Feb 24, 2026
  10. added a commit that references this issue on Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Sponsor
    SponsoredKunjungi sekarang
    Promo