Skip to content

Commit

Permalink
chore: rename convertion func
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Poignant <[email protected]>
  • Loading branch information
thomaspoignant committed Oct 3, 2024
1 parent ae8c197 commit 973951c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dao/dbmodel/feature_flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ func FromModelFeatureFlag(mff model.FeatureFlag) (FeatureFlag, error) {
}, nil
}

func (ff *FeatureFlag) ToAPI(rules []Rule) (model.FeatureFlag, error) {
func (ff *FeatureFlag) ToModelFeatureFlag(rules []Rule) (model.FeatureFlag, error) {

Check warning on line 76 in dao/dbmodel/feature_flag.go

View check run for this annotation

Codecov / codecov/patch

dao/dbmodel/feature_flag.go#L76

Added line #L76 was not covered by tests
var apiRules = make([]model.Rule, 0)
var defaultRule *model.Rule
for _, rule := range rules {
convertedRule, err := rule.ToAPI()
convertedRule, err := rule.ToModelRule()

Check warning on line 80 in dao/dbmodel/feature_flag.go

View check run for this annotation

Codecov / codecov/patch

dao/dbmodel/feature_flag.go#L80

Added line #L80 was not covered by tests
if err != nil {
return model.FeatureFlag{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion dao/dbmodel/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func FromModelRule(mr model.Rule, featureFlagID uuid.UUID, isDefault bool, order
return dbr, nil
}

func (rule *Rule) ToAPI() (model.Rule, error) {
func (rule *Rule) ToModelRule() (model.Rule, error) {

Check warning on line 80 in dao/dbmodel/rule.go

View check run for this annotation

Codecov / codecov/patch

dao/dbmodel/rule.go#L80

Added line #L80 was not covered by tests
apiRule := model.Rule{
ID: rule.ID.String(),
Name: rule.Name,
Expand Down
6 changes: 3 additions & 3 deletions dao/postgres_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (m *pgFlagImpl) GetFlags(ctx context.Context) ([]model.FeatureFlag, error)
return []model.FeatureFlag{}, err
}

convertedFlag, err := flag.ToAPI(rules)
convertedFlag, err := flag.ToModelFeatureFlag(rules)

Check warning on line 56 in dao/postgres_impl.go

View check run for this annotation

Codecov / codecov/patch

dao/postgres_impl.go#L56

Added line #L56 was not covered by tests
if err != nil {
return []model.FeatureFlag{}, err
}
Expand All @@ -80,7 +80,7 @@ func (m *pgFlagImpl) GetFlagByID(ctx context.Context, id string) (model.FeatureF
return model.FeatureFlag{}, errRule
}

convertedFlag, err := f.ToAPI(rules)
convertedFlag, err := f.ToModelFeatureFlag(rules)

Check warning on line 83 in dao/postgres_impl.go

View check run for this annotation

Codecov / codecov/patch

dao/postgres_impl.go#L83

Added line #L83 was not covered by tests
if err != nil {
return model.FeatureFlag{}, err
}
Expand All @@ -102,7 +102,7 @@ func (m *pgFlagImpl) GetFlagByName(ctx context.Context, name string) (model.Feat
return model.FeatureFlag{}, errRule
}

convertedFlag, err := f.ToAPI(rules)
convertedFlag, err := f.ToModelFeatureFlag(rules)

Check warning on line 105 in dao/postgres_impl.go

View check run for this annotation

Codecov / codecov/patch

dao/postgres_impl.go#L105

Added line #L105 was not covered by tests
if err != nil {
return model.FeatureFlag{}, err
}
Expand Down

0 comments on commit 973951c

Please sign in to comment.