Refactored the application structure to better separate concerns between files and packages
Some checks failed
ci/woodpecker/push/build-image Pipeline failed
Some checks failed
ci/woodpecker/push/build-image Pipeline failed
This commit is contained in:
55
internal/adapters/inbound/httpapi/presenter/helpers.go
Normal file
55
internal/adapters/inbound/httpapi/presenter/helpers.go
Normal file
@@ -0,0 +1,55 @@
|
||||
// helpers.go contains shared pointer and scalar conversion helpers.
|
||||
// Layer: adapters/inbound/httpapi/presenter helper functions.
|
||||
package presenter
|
||||
|
||||
import "time"
|
||||
|
||||
func celsiusToFahrenheitPtr(v *float64) *float64 {
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
out := (*v * celsiusToFahrenheitScale) + celsiusToFahrenheitOffset
|
||||
return &out
|
||||
}
|
||||
|
||||
func scalePtr(v *float64, factor float64) *float64 {
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
out := *v * factor
|
||||
return &out
|
||||
}
|
||||
|
||||
func copyFloat64Ptr(v *float64) *float64 {
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
out := *v
|
||||
return &out
|
||||
}
|
||||
|
||||
func copyBoolPtr(v *bool) *bool {
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
out := *v
|
||||
return &out
|
||||
}
|
||||
|
||||
func copyTimePtr(v *time.Time) *time.Time {
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
out := *v
|
||||
return &out
|
||||
}
|
||||
|
||||
func boolText(v *bool) string {
|
||||
if v == nil {
|
||||
return ""
|
||||
}
|
||||
if *v {
|
||||
return "true"
|
||||
}
|
||||
return "false"
|
||||
}
|
||||
Reference in New Issue
Block a user