Sha256: a2c28090a9220ad8dbb8d21c56ee1fa80db053d2fb78f840940e33fd0632a7e3
Contents?: true
Size: 673 Bytes
Versions: 16
Compression:
Stored size: 673 Bytes
Contents
class SchemaCommentMatcher KEY_DELIM = '_'.freeze def self.load_cache @cache = {} comments = SchemaComment.all comments.each do |comment| k = [comment.schema, comment.table, comment.column, comment.target_type].join(KEY_DELIM) @cache[k] = comment end end def self.enrich(columns) load_cache columns.each do |column| k = [column[:schema], column[:table], column[:column], column[:type]].join(KEY_DELIM) comment = @cache[k] if comment.present? column[:comment_text] = comment.text column[:comment_user_id] = comment.user_id column[:comment_id] = comment.id end end end end
Version data entries
16 entries across 16 versions & 1 rubygems