(Feat): Initial Commit
Some checks failed
Build & Test / build-test (push) Has been cancelled
Build & Test / swagger-codegen-cli (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled

This commit is contained in:
2026-07-03 19:41:31 +05:30
commit 7e940c83a7
461 changed files with 45002 additions and 0 deletions

60
internal/util/currency.go Normal file
View File

@@ -0,0 +1,60 @@
// nolint:revive
package util
import "github.com/go-openapi/swag"
const (
centFactor = 100
)
func Int64PtrWithCentsToFloat64Ptr(c *int64) *float64 {
if c == nil {
return nil
}
return Int64WithCentsToFloat64Ptr(*c)
}
func Int64WithCentsToFloat64Ptr(c int64) *float64 {
return swag.Float64(float64(c) / centFactor)
}
func IntPtrWithCentsToFloat64Ptr(c *int) *float64 {
if c == nil {
return nil
}
return IntWithCentsToFloat64Ptr(*c)
}
func IntWithCentsToFloat64Ptr(c int) *float64 {
return swag.Float64(float64(c) / centFactor)
}
func Float64PtrToInt64PtrWithCents(f *float64) *int64 {
if f == nil {
return nil
}
return swag.Int64(Float64PtrToInt64WithCents(f))
}
func Float64PtrToInt64WithCents(f *float64) int64 {
return int64(swag.Float64Value(f) * centFactor)
}
func Float64ToInt64WithCents(f float64) int64 {
return int64(f * centFactor)
}
func Float64PtrToIntPtrWithCents(f *float64) *int {
if f == nil {
return nil
}
return swag.Int(Float64PtrToIntWithCents(f))
}
func Float64PtrToIntWithCents(f *float64) int {
return int(swag.Float64Value(f) * centFactor)
}