Files
onepanel/pkg/label_types.go
Andrey Melnikov d209423100 clean:
* 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.
2020-06-20 13:18:52 -07:00

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
}