Esempio n. 1
0
func main() {

	new_id, _ := common.GenId()
	key_body := make(map[string]interface{}, 0)
	query_body := make(map[string]interface{}, 0)
	key_body["Id"] = new_id
	query_body["SourcePath"] = "/etc/lss.mix"
	query_body["SourceType"] = "file"
	create_new_query := cross.Query{Table: types.DYNIMAS_T, KeyBody: key_body, QueryBody: query_body, Type: types.CREATE_NEW}

	get_query_body := make(map[string]interface{}, 0)
	get_query_body["SourceType"] = "file"
	get_query := cross.Query{Table: types.DYNIMAS_T, KeyBody: get_query_body, Type: types.GET_ALL}

	res1, err1 := database.RunQuery(create_new_query)
	res2, err2 := database.RunQuery(get_query)

	fmt.Printf("Res1:\n%v\n%v\n##################\n", res1, err1)
	fmt.Printf("Res2:%v\n", err2)
	for i := range *res2 {
		get_res := (*res2)[i]
		fmt.Printf("%v\n", get_res)

	}
}
Esempio n. 2
0
func SetNewHostId() error {
	new_id, _ := common.GenId()
	key_body := make(map[string]interface{}, 0)
	query_body := make(map[string]interface{}, 0)
	key_body["key"] = "host_id"
	query_body["query"] = new_id
	create_query := cross.Query{Type: types.CREATE_NEW, Table: types.SOLIS_T, KeyBody: key_body, QueryBody: query_body}

	_, err := database.RunQuery(create_query)
	return err
}