Blame view
select_config.go
1.37 KB
ea858b8a7 refactoring |
1 |
package webutility |
39765a430 added list and se... |
2 |
|
1d0f61553 can't fetch clob |
3 4 |
//import "gopkg.in/rana/ora.v3" import "gopkg.in/rana/ora.v4" |
39765a430 added list and se... |
5 6 7 8 9 10 11 12 13 |
type SelectConfig struct { ListObjType string `json:"listObjectType"` ObjType string `json:"objectType"` Type string `json:"type"` IdField string `json:"idField"` LabelField string `json:"labelField"` ValueField string `json:"valueField"` } |
e1fbb41f9 added comments |
14 |
// GetSelectConfig returns select configuration slice for the given object type. |
39765a430 added list and se... |
15 16 17 18 |
func GetSelectConfig(db *ora.Ses, otype string) ([]SelectConfig, error) { resp := make([]SelectConfig, 0) var err error var stmt *ora.Stmt |
d2ddf82ef started on new rbac |
19 20 21 22 23 24 25 |
query := `SELECT a.LIST_OBJECT_TYPE, a.OBJECT_TYPE, a.ID_FIELD, a.LABEL_FIELD, a.TYPE, b.FIELD |
39765a430 added list and se... |
26 27 28 29 |
FROM LIST_SELECT_CONFIG a, LIST_VALUE_FIELD b WHERE a.LIST_OBJECT_TYPE` + otype + ` AND b.LIST_TYPE = a.LIST_OBJECT_TYPE AND b.OBJECT_TYPE = a.OBJECT_TYPE` |
33fd58161 minor changes, sh... |
30 |
stmt, err = db.Prep(query, ora.S, ora.S, ora.S, ora.S, ora.S, ora.S) |
39765a430 added list and se... |
31 32 33 34 35 36 37 38 39 40 41 42 |
defer stmt.Close() if err != nil { return nil, err } rset, err := stmt.Qry() if err != nil { return nil, err } for rset.Next() { resp = append(resp, SelectConfig{ ListObjType: rset.Row[0].(string), |
d2ddf82ef started on new rbac |
43 44 45 46 47 |
ObjType: rset.Row[1].(string), IdField: rset.Row[2].(string), LabelField: rset.Row[3].(string), Type: rset.Row[4].(string), ValueField: rset.Row[5].(string), |
39765a430 added list and se... |
48 49 |
}) } |
1d0f61553 can't fetch clob |
50 51 |
if rset.Err() != nil { return nil, rset.Err() |
39765a430 added list and se... |
52 53 54 |
} return resp, nil |
39765a430 added list and se... |
55 |
} |