Cleanup, bug fixes, and improvements
This commit changes how projects are handled internally so that projects can be renamed. This commit also fixes some bugs, and removes redundant code.
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package pkg
|
||||
|
||||
import "github.com/google/uuid"
|
||||
|
||||
type App struct {
|
||||
ID int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
DeploymentID int64 `json:"deployment_id,omitempty"`
|
||||
DeploymentStatus string `json:"deployment_status,omitempty"`
|
||||
Id uuid.UUID `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
DeploymentID int64 `json:"deployment_id,omitempty"`
|
||||
DeploymentStatus string `json:"deployment_status,omitempty"`
|
||||
}
|
||||
|
||||
// TODO: this should be flattened to an int, where 0 = disabled and any other number is the level
|
||||
|
||||
30
pkg/typedmap.go
Normal file
30
pkg/typedmap.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package pkg
|
||||
|
||||
import "sync"
|
||||
|
||||
type TypedMap[K comparable, V any] struct {
|
||||
internal sync.Map
|
||||
}
|
||||
|
||||
func (m *TypedMap[K, V]) Load(key K) (V, bool) {
|
||||
val, ok := m.internal.Load(key)
|
||||
if !ok {
|
||||
var zero V
|
||||
return zero, false
|
||||
}
|
||||
return val.(V), true
|
||||
}
|
||||
|
||||
func (m *TypedMap[K, V]) Store(key K, value V) {
|
||||
m.internal.Store(key, value)
|
||||
}
|
||||
|
||||
func (m *TypedMap[K, V]) Delete(key K) {
|
||||
m.internal.Delete(key)
|
||||
}
|
||||
|
||||
func (m *TypedMap[K, V]) Range(f func(key K, value V) bool) {
|
||||
m.internal.Range(func(k, v any) bool {
|
||||
return f(k.(K), v.(V))
|
||||
})
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
package pkg
|
||||
|
||||
const Version = "2025.04.13-05"
|
||||
const Version = "2025.04.13-10"
|
||||
|
||||
Reference in New Issue
Block a user