api_w_render.go 527 B

1234567891011121314151617181920212223242526
  1. package route
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "opennamu/route/tool"
  6. )
  7. func Api_w_render(call_arg []string) {
  8. db_set := map[string]string{}
  9. json.Unmarshal([]byte(call_arg[0]), &db_set)
  10. other_set := map[string]string{}
  11. json.Unmarshal([]byte(call_arg[1]), &other_set)
  12. db := tool.DB_connect(db_set)
  13. if db == nil {
  14. return
  15. }
  16. defer db.Close()
  17. data := tool.Get_render(db, db_set, other_set["doc_name"], other_set["data"], other_set["render_type"])
  18. json_data, _ := json.Marshal(data)
  19. fmt.Print(string(json_data))
  20. }