50bf71bc5c57303fb4d7225283f48cd13ba41bcf angie Wed Nov 18 23:20:57 2015 -0800 Change to interface of annoStreamDbNew: instead of making the caller pass in an asObject, the caller may now pass in a parsed JSON config object (or NULL). annoStreamDbNew will use this config object to determine whether related tables need to be joined with the track table, and produce its own asObj. It doesn't actually do that yet -- this is just an interface change that will enable it to do so. refs #15544 diff --git src/hg/inc/annoStreamDb.h src/hg/inc/annoStreamDb.h index 9c4722b..dae1e4e 100644 --- src/hg/inc/annoStreamDb.h +++ src/hg/inc/annoStreamDb.h @@ -1,15 +1,29 @@ /* annoStreamDb -- subclass of annoStreamer for database tables */ /* Copyright (C) 2013 The Regents of the University of California * See README in this or parent directory for licensing information. */ #ifndef ANNOSTREAMDB_H #define ANNOSTREAMDB_H #include "annoStreamer.h" +#include "jsonParse.h" struct annoStreamer *annoStreamDbNew(char *db, char *table, struct annoAssembly *aa, - struct asObject *asObj, int maxOutRows); -/* Create an annoStreamer (subclass) object from a database table described by asObj. */ + int maxOutRows, struct jsonElement *config); +/* Create an annoStreamer (subclass) object from a database table. + * If config is NULL, then the streamer produces output from all fields + * (except bin, unless table's autoSql includes bin). + * Otherwise, config is a json object with a member 'relatedTables' that specifies + * related tables and fields to join with table, for example: + * config = { "relatedTables": [ { "table": "hg19.kgXref", + * "fields": ["geneSymbol", "description"] }, + * { "table": "hg19.knownCanonical", + * "fields": ["clusterId"] } + * ] } + * -- the streamer's autoSql will be constructed by appending autoSql column + * descriptions to the columns of table. + * Caller may free db, table, and dbTableFieldList when done with them, but must keep the + * annoAssembly aa alive for the lifetime of the returned annoStreamer. */ #endif//ndef ANNOSTREAMDB_H