Remodelando para uma estrutura menos rigida Nuveo v1 em Go e MongoDB Nuveo v2 Go e PostgreSQL com suporte a JSONB Reescrever todas as queries de todos os sistemas postgREST (https://github.com/begri s/postgrest, Haskell), di cil de manter em produção
len(columns) tableData := make([]map[string]interface{}, 0) values := make([]interface{}, count) valuePtrs := make([]interface{}, count) for rows.Next() { for i := 0; i < count; i++ { valuePtrs[i] = &values[i] } rows.Scan(valuePtrs...) entry := make(map[string]interface{}) for i, col := range columns { var v interface{} val := values[i] b, ok := val.([]byte) if ok { v = string(b) } else { v = val } entry[col] = v } tableData = append(tableData, entry) } jsonData, err = json.Marshal(tableData)
{ router := mux.NewRouter() router.HandleFunc("/{database}/{schema}", GetTablesByDatabaseAndSchema).Methods("GET") server := httptest.NewServer(router) defer server.Close() Convey("Get tables by database and schema without custom where clause", t, func() { doValidGetRequest(server.URL+"/prest/public", "GetTablesByDatabaseAndSchema") }) Convey("Get tables by database and schema with custom where clause", t, func() { doValidGetRequest(server.URL+"/prest/public?t.tablename=test", "GetTablesByDatabaseAndSchema") }) Convey("Get tables by database and schema with custom where clause and pagination", t, func() { doValidGetRequest(server.URL+"/prest/public?t.tablename=test&_page=1&_page_size=20", "GetTablesByData }) }