Sha256: 79315869f6b687de932b213b0b24e91da36a58e47be57fb79e5750077fdfeefa
Contents?: true
Size: 788 Bytes
Versions: 1
Compression:
Stored size: 788 Bytes
Contents
# frozen_string_literal: true require 'avromatic/model/types/abstract_timestamp_type' module Avromatic module Model module Types # This subclass is used to truncate timestamp values to microseconds. class TimestampMicrosType < Avromatic::Model::Types::AbstractTimestampType def name 'timestamp-micros' end private def truncated?(value) value.nsec % 1_000 == 0 end def coerce_time(input) # value is coerced to a local Time # The Avro representation of a timestamp is Epoch seconds, independent # of time zone. ::Time.at(input.to_i, input.usec) end def referenced_model_classes EMPTY_ARRAY end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
avromatic-2.2.2 | lib/avromatic/model/types/timestamp_micros_type.rb |