added Config Manager model
This commit is contained in:
parent
92bc1ce712
commit
4de48935bd
54
modules/config/model/Config.go
Normal file
54
modules/config/model/Config.go
Normal file
|
@ -0,0 +1,54 @@
|
|||
package model
|
||||
|
||||
|
||||
type Connection struct {
|
||||
Ip string `json:"ip,omitempty"`
|
||||
Port string `json:"port,omitempty"`
|
||||
PortType string `json:"portType,omitempty"`
|
||||
SSL bool `json:"ssl,omitempty"`
|
||||
}
|
||||
|
||||
type Target struct {
|
||||
Auth map[string]interface{} `json:"auth,omitempty"`
|
||||
Connection Connection `json:"connection,omitempty"`
|
||||
}
|
||||
|
||||
type Schedule struct {
|
||||
Interval string `json:"interval,omitempty"`
|
||||
}
|
||||
|
||||
type Keys struct {
|
||||
Metric string `json:"metric,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
}
|
||||
|
||||
type QueryInfo struct {
|
||||
Query string `json:"query,omitempty"`
|
||||
Extend map[string]interface{} `json:"extend,omitempty"`
|
||||
}
|
||||
|
||||
type MappingInfo struct {
|
||||
ParseDirection string `json:"parseDirection,omitempty"`
|
||||
ArrayColumns []string `json:"arrayColumns,omitempty"`
|
||||
KeyColumns []string `json:"keyColumns,omitempty"`
|
||||
ValueColumn string `json:"valueColumn,omitempty"`
|
||||
}
|
||||
|
||||
type Item struct {
|
||||
Keys []Keys `json:"keys,omitempty"`
|
||||
QueryInfo QueryInfo `json:"queryInfo,omitempty"`
|
||||
MappingInfo MappingInfo `json:"mappingInfo,omitempty"`
|
||||
}
|
||||
|
||||
type Crawler struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Container string `json:"container,omitempty"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
Target Target `json:"target,omitempty"`
|
||||
Schedule Schedule `json:"schedule,omitempty"`
|
||||
Crawler Crawler `json:"crawler,omitempty"`
|
||||
Items []Item `json:"items,omitempty"`
|
||||
}
|
15
modules/config/util/Util.go
Normal file
15
modules/config/util/Util.go
Normal file
|
@ -0,0 +1,15 @@
|
|||
package util
|
||||
|
||||
import "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
|
||||
|
||||
func KeysToMap(keys []model.Keys) map[string]string {
|
||||
|
||||
m := make(map[string]string)
|
||||
|
||||
|
||||
for _, key := range keys {
|
||||
m[key.Key] = key.Metric
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
Loading…
Reference in New Issue
Block a user