mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-09-27 10:02:10 +08:00

* updated method names to fit go conventions of uppercase. Db -> DB * updated some method calls to use updated column select functions to remove extraneous empty string * updated methods to use new label function that does nothing if no labels are passed in, this simplifies the code. * updated some methods to use new Selectx function, reducing code in caller.
23 lines
386 B
Go
23 lines
386 B
Go
package v1
|
|
|
|
import "time"
|
|
|
|
type Label struct {
|
|
ID uint64
|
|
CreatedAt time.Time `db:"created_at"`
|
|
Key string
|
|
Value string
|
|
Resource string
|
|
ResourceID uint64 `db:"resource_id"`
|
|
}
|
|
|
|
func LabelsToMapping(labels ...*Label) map[string]string {
|
|
result := make(map[string]string)
|
|
|
|
for _, label := range labels {
|
|
result[label.Key] = label.Value
|
|
}
|
|
|
|
return result
|
|
}
|