Sha256: 9b57c5cc3dd5147c0e8369d6fe46bfe052de65b240245573729fcc9ca44fdb81
Contents?: true
Size: 1.84 KB
Versions: 19
Compression:
Stored size: 1.84 KB
Contents
require 'indented_io' module PgGraph::Type class Node def dump(children = self.children.values.sort_by(&:name), link_info: false, supertable: nil) print identifier + (supertable ? " < #{supertable}" : "") puts indent { children.each { |child| child.dump(link_info: link_info) } } end end class Schema def dump(link_info: false) super(record_types.sort_by(&:name), link_info: link_info) end end class RecordType def dump(**opts) supertable = table.supertable&.identifier columns = fields.reject { |column| column.primary_key? || column.name =~ /_id$/ || column.name =~ /_kind$/ # FIXME } super(columns, supertable: supertable, **opts) end end class Column def dump(link_info: false) print "#{identifier}: " method = type.schema == record_type.schema ? :identifier : :schema_identifier if self.is_a?(MmTableColumn) && !self.is_a?(NmTableColumn) type_identifier = "{[#{type.element_type.send(method)}]}" else type_identifier = type.send(method) end print type_identifier print "()" if generated? print "[#{that_link_column}]" if kind? print "?" if nullable? print "!" if unique? dump_type if link_info puts end def dump_type() end end class RecordColumn def dump_type print " (#{this_link_column} -> #{type.table.name}.#{that_link_column}) (RecordColumn)" end end class TableColumn def dump_type print " (#{this_link_column} -> #{type.table.name}.#{that_link_column}) (TableColumn)" end end class MmTableColumn def dump_type print \ " (#{this_link_column} -> #{mm_table.name}.#{this_mm_column}," + " #{mm_table.name}.#{that_mm_column} -> #{that_table.name}.#{that_link_column}) (MmTableColumn)" end end end
Version data entries
19 entries across 19 versions & 1 rubygems