Skip to content

Commit

Permalink
chore: rename settings FromAPI constructor (#1126)
Browse files Browse the repository at this point in the history
Co-authored-by: Easton Crupper <[email protected]>
  • Loading branch information
plyr4 and ecrupper committed May 13, 2024
1 parent 6a9e509 commit 9357113
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion database/settings/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (e *engine) CreateSettings(_ context.Context, s *settings.Platform) (*setti
e.logger.Tracef("creating platform settings in the database with %v", s.String())

// cast the api type to database type
settings := types.FromAPI(s)
settings := types.SettingsFromAPI(s)

// validate the necessary fields are populated
err := settings.Validate()
Expand Down
2 changes: 1 addition & 1 deletion database/settings/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (e *engine) UpdateSettings(_ context.Context, s *settings.Platform) (*setti
e.logger.Trace("updating platform settings in the database")

// cast the api type to database type
dbS := types.FromAPI(s)
dbS := types.SettingsFromAPI(s)

// validate the necessary fields are populated
err := dbS.Validate()
Expand Down
4 changes: 2 additions & 2 deletions database/types/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ func (ps *Platform) Validate() error {
return nil
}

// FromAPI converts the API Settings type
// SettingsFromAPI converts the API Settings type
// to a database Settings type.
func FromAPI(s *settings.Platform) *Platform {
func SettingsFromAPI(s *settings.Platform) *Platform {
settings := &Platform{
ID: sql.NullInt64{Int64: s.GetID(), Valid: true},
Compiler: Compiler{
Expand Down
2 changes: 1 addition & 1 deletion database/types/settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestTypes_Platform_PlatformFromAPI(t *testing.T) {
want := testPlatform()

// run test
got := FromAPI(s)
got := SettingsFromAPI(s)

if !reflect.DeepEqual(got, want) {
t.Errorf("PlatformFromAPI is %v, want %v", got, want)
Expand Down

0 comments on commit 9357113

Please sign in to comment.