Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored client library code for Data Types for consolidating type transformation logic #2

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

gunjan-juyal
Copy link
Owner

Refactored client library code to consolidaet all Data Types transformation logic in one place.

    This refactoring is attempting the following benefits:
    1. Code reuse for common value encoding conversions
    2. Reducing the number of places when adding a new data-type, especially the type-related conversion logic.

[Note: This PR is raised on a fork of the java-spanner client repo. It is currently a prototype, and once things look promising a separate PR will be raised for merging this to the official repo.]

…-reuse.

This refactoring is attempting the following benefits:
1. Code reuse for common value encoding conversions
2. Reducing the number of places when adding a new data-type, especially the type-related conversion logic.
3. Refactor the existing primitive types to use the new helper functions to simplify existing code.
… set, setting query parameters and mutations
…mation logic in one place.

    This refactoring is attempting the following benefits:
    1. Code reuse for common value encoding conversions
    2. Reducing the number of places when adding a new data-type, especially the type-related conversion logic.
…verters used by GenericValue type - String, Json, PG Jsonb, Bool and Float64. This also covers all the possible wire encoding values (namely Number, Bool and String).
…using the new Converter framework will help demonstrate the ease-of-use benefits
…er (missing files from last commit). WIP - A simple prototype code-replacer
…n for Value default array implementation class and a test that must override public methods.
@gunjan-juyal gunjan-juyal marked this pull request as draft February 4, 2024 08:10
# Conflicts:
#	google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java
#	google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java
#	google-cloud-spanner/src/main/java/com/google/cloud/spanner/ForwardingStructReader.java
#	google-cloud-spanner/src/main/java/com/google/cloud/spanner/Key.java
#	google-cloud-spanner/src/main/java/com/google/cloud/spanner/StructReader.java
#	google-cloud-spanner/src/main/java/com/google/cloud/spanner/Type.java
#	google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java
#	google-cloud-spanner/src/main/java/com/google/cloud/spanner/ValueBinder.java
#	google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsTest.java
#	google-cloud-spanner/src/test/java/com/google/cloud/spanner/StatementTest.java
#	google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueBinderTest.java
#	google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/RandomResultSetGenerator.java
#	google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ReadWriteTransactionTest.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant