Sha256: 23f1525a4f8da218ba1ec705357599fe292b9ab665d1faeaffb7c94e30165261
Contents?: true
Size: 875 Bytes
Versions: 64
Compression:
Stored size: 875 Bytes
Contents
# frozen_string_literal: true # Maps MySQL data types to type descriptions the client can use. class MysqlTypes def initialize raise "can't instantiate #{self.class}" end class << self def map_to_google_charts_types(types) types.map do |type| type = type.gsub(/\([^)]*\)/, '').strip case type when 'bool', 'boolean' 'boolean' when /double/, 'bigint', 'bit', 'dec', 'decimal', 'float', 'int', 'integer', 'mediumint', 'smallint', 'tinyint' 'number' when /char/, /binary/, /blob/, /text/, 'enum', 'set', /image/ 'string' when 'date', 'year' 'date' when 'datetime', 'timestamp' 'datetime' when 'time' 'timeofday' else puts "unexpected MySQL type: #{type}" 'string' end end end end end
Version data entries
64 entries across 64 versions & 1 rubygems