Module:Cargo

local p = {}

local cargo = mw.ext.cargo local rtable = require( 'module:table' )

function p.query( f ) local args        = rtable.trimAll( f.args ) local query_result = cargo.query( args.tables, args.fields or '', {       join    = args['join on'],        where   = args.where,        groupBy = args['group by'],        having  = args.having,        orderBy = args['order by'] or '_ID',        limit   = args.limit,        offset  = args.offset    } ) local parsed_result = '' for _, element in ipairs( query_result ) do       parsed_result = parsed_result .. mw.getCurrentFrame:expandTemplate{ title = args.template, args = rtable.igsub( element, '_', ' ' ) }   end return parsed_result end

return p