-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathmetadata.go
executable file
·40 lines (34 loc) · 1.09 KB
/
metadata.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package sqlquery
import "github.com/project-flogo/core/data/coerce"
type Settings struct {
DbType string `md:"dbType,allowed(mysql,oracle,postgres,sqlite,sqlserver), required"`
DriverName string `md:"driverName,required"`
DataSourceName string `md:"dataSourceName,required"`
Query string `md:"query,required"`
MaxOpenConns int `md:"maxOpenConnections"`
MaxIdleConns int `md:"maxIdleConnections"`
DisablePrepared bool `md:"disablePrepared"`
LabeledResults bool `md:"labeledResults"`
}
type Input struct {
Params map[string]interface{} `md:"params"`
}
type Output struct {
ColumnNames []interface{} `md:"columnNames"`
Results interface{} `md:"results"`
}
// FromMap converts the values from a map into the struct Input
func (i *Input) FromMap(values map[string]interface{}) error {
params, err := coerce.ToObject(values["params"])
if err != nil {
return err
}
i.Params = params
return nil
}
// ToMap converts the struct Input into a map
func (i *Input) ToMap() map[string]interface{} {
return map[string]interface{}{
"params": i.Params,
}
}