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

BT-4366 Encoding #7

Closed
wants to merge 1 commit into from
Closed

BT-4366 Encoding #7

wants to merge 1 commit into from

Conversation

IvanAlfer
Copy link

Ticket(s): BT-4366

Problem

Create encoder

Solution

I've created the FaunaEncoder class, which provides static methods to convert Java objects to their corresponding Fauna representations. This class handles standard data types (e.g., String, Integer, Long, Double, LocalDateTime, LocalDate, Boolean, and null), as well as custom objects like Document, DocumentReference, NamedDocument, NamedDocumentReference, Module, and Query. The encoding respects Fauna's reserved tags and ensures that complex objects like lists and maps are correctly translated to Fauna queries.

Result

The FaunaEncoder utility class will centralize all encoding logic. With these changes, we will be able to maintain high data integrity when sending queries to Fauna

Testing

The FaunaEncoderTest suite ensures the correctness of encoding operations. It tests the encoding of basic types, complex objects, and edge cases, such as reserved tag conflicts and deep nesting. The suite also verifies the proper encoding of larger data structures and query interpolations. Special attention is given to the encoding of date and time to ensure timezone-awareness is maintained


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@pnwpedro
Copy link
Collaborator

pnwpedro commented Nov 9, 2023

After a quick discussion, this is the plan with this PR. Cc @CLBray

  • Break models into separate PR
  • Develop plan for dealing with user-defined types first, and ensure that the encoding impl can support them
  • PR for encoding primitives
  • PR for encoding fauna special types
  • PR that adapts Add support for array and object encoding fauna-python#152 requirements into map/array handling
  • PR for handling user-defined types

@IvanAlfer IvanAlfer closed this Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants