Giter Site home page Giter Site logo

Comments (2)

kiwicopple avatar kiwicopple commented on May 6, 2024

@dragarcia this could be a good first task for elixir tomorrow.

from realtime.

dragarcia avatar dragarcia commented on May 6, 2024

Solution

Now that we forked away from PGOutputDecoder, the following were implemented:

  1. server/lib/decoder/oid_database.ex
    • Update the mapping on server/lib/decoder/oid_database.ex to cover all base PgSQL data types. This is based on this
    • Change mapping function to parse through the comprehensive map instead of creating multiple functions to map to each data type. If the data_type_id is found, the corresponding data type name is provided. If not found, then the data type id is returned.
  2. server/lib/realtime/replication.ex
    • We noticed that for unique data types, they are being broadcasted under the Type flag. We utilised this opportunity under process_message(%Type{} = msg, state) to create a mapping of unique data type IDs and their corresponding data type name.
    • Under process_message(%Relation{} = msg, state), we take the list of columns processed by the function mentioned above by oid_database.ex and go through each column.
    • If the type of the column is found as a key in the mapping of unique data type IDs and its names, then we update the type to be the corresponding name of the data type id.
    • This now ensures that all data types are properly identified and labeled before reaching the client.

How I tested

  1. Run monorepo without realtime
  2. Run a local version of realtime, ensuring that the database connection is pointed to the database in monorepo
  3. Run HQ locally and start making changes
  4. Observe the logs on the local version of realtime.
    • I left a log to show that all columns have been labeled properly
    • This is ran in the very last process_message function that is ran before being sent to the client which is:
process_message(
        %Commit{lsn: commit_lsn, end_lsn: end_lsn},
        %State{transaction: {current_txn_lsn, _txn}} = state
      )

from realtime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.