Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

refactor: make property.Value and dataset.Value independent in pkg/value #77

Merged
merged 13 commits into from
Nov 26, 2021

Conversation

rot1024
Copy link
Member

@rot1024 rot1024 commented Nov 18, 2021

Refactoring has been done to facilitate the various Re:Earth property enhancements planned for the future:

Tasks

  • Move logic of property.Value and dataset.Value to pkg/value
  • Refactor pkg/property, pkg/dataset, pkg/layer
  • Change some layer encoder output (e.g. style ID of KMLs)

How does this change tested

  • Unit tests confirmed that no degreasing had occurred
  • I confirmed properties are correctly fetched and updated at local env

Review point

You don't need check all files, but check pkg/value/*.go.

  • property.Value and dataset.Value wraps value.Value, property.ValueType and dataset.ValueType wraps value.Type, property.OptionalValue and dataset.OptionalValue wraps value.OptionalValue.
  • value.TypeProperty can define a new value type for value.Value. It is used by pkg/property. typography and camera type are defined at pkg/property/value.go because they are never used as dataset values.
  • pkg/dataset does not define any new type. Types of dataset values are the same as default types of pkg/value.
  • value.OptionalValue provides a way to treat optional (nullable) values safety. If either type or value of an value.OptionalValue is invalid, it will turn into nil and any operation for it will not be succeeded. value.OptionalValue is used by property.Field and dataset.Field.

@codecov
Copy link

codecov bot commented Nov 18, 2021

Codecov Report

Merging #77 (3f364d1) into main (5e3d253) will decrease coverage by 1.04%.
The diff coverage is 46.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #77      +/-   ##
==========================================
- Coverage   35.31%   34.26%   -1.05%     
==========================================
  Files         261      276      +15     
  Lines       17723    17454     -269     
==========================================
- Hits         6259     5981     -278     
- Misses      10602    10669      +67     
+ Partials      862      804      -58     
Impacted Files Coverage Δ
internal/adapter/gql/resolver_mutation_property.go 0.00% <0.00%> (ø)
internal/infrastructure/memory/dataset.go 0.00% <0.00%> (ø)
internal/infrastructure/memory/dataset_schema.go 0.00% <ø> (ø)
internal/infrastructure/mongo/mongodoc/dataset.go 0.00% <0.00%> (ø)
...al/infrastructure/mongo/mongodoc/dataset_schema.go 0.00% <0.00%> (ø)
internal/infrastructure/mongo/mongodoc/property.go 0.00% <0.00%> (ø)
...l/infrastructure/mongo/mongodoc/property_schema.go 0.00% <0.00%> (ø)
internal/infrastructure/mongo/mongodoc/util.go 0.00% <0.00%> (ø)
internal/usecase/interactor/dataset.go 0.00% <0.00%> (ø)
internal/usecase/interactor/property.go 0.00% <0.00%> (ø)
... and 54 more

@rot1024 rot1024 merged commit 73143b7 into main Nov 26, 2021
@rot1024 rot1024 deleted the refactor/value branch November 26, 2021 09:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants