Uploaded image for project: 'Hybrid Cloud Console'
  1. Hybrid Cloud Console
  2. RHCLOUD-18371

Refactor: remove the "Pause" embeded structs and make "paused_at" a poitner

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • None
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • Unset

      Right now the "paused_at" fields go embedded in any model that requires them. The suggestion is to remove the structure and to just use a plain "paused_at" pointer field in the models that require it.

      The reasons are:

      1. The "Pause" structure only holds a "paused_at" field.
      2. The pointer to "time.Time" would allow us to insert "nil" values into the database, which is a perfectly valid value for a resource: if it is nil, the resource is "unpaused", if it has a date, it is considered to be "paused". Since we are using a non-pointer "time.Time" value, every time we insert a resource a default date gets inserted into the database, which makes it a little bit harder to query about the pause status than it needs to be.

      Keep in mind to remove the extra "Where" condition with the default date on the "IsPaused" methods when working on this one.

            Unassigned Unassigned
            mbarcina@redhat.com Mikel Barcina
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: