module DB::MetadataValueConverter

Overview

This module converts DB supported values to ::Log::Metadata::Value

Note to implementors

If the driver defines custom types to be used as arguments the default behavior will be converting the value via #to_s. Otherwise you can define overloads to change this behaviour.

module DB::MetadataValueConverter
  def self.arg_to_log(arg : PG::Geo::Point)
    ::Log::Metadata::Value.new("(#{arg.x}, #{arg.y})::point")
  end
end

Defined in:

db/statement.cr

Class Method Summary

Class Method Detail

def self.arg_to_log(arg : Enumerable) : ::Log::Metadata::Value #

Returns arg encoded as a ::Log::Metadata::Value.


[View source]
def self.arg_to_log(arg : UInt64) : ::Log::Metadata::Value #

Returns arg encoded as a ::Log::Metadata::Value.


[View source]
def self.arg_to_log(arg : Int) : ::Log::Metadata::Value #

Returns arg encoded as a ::Log::Metadata::Value.


[View source]
def self.arg_to_log(arg : Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Time) : ::Log::Metadata::Value #

Returns arg encoded as a ::Log::Metadata::Value.


[View source]
def self.arg_to_log(arg) : ::Log::Metadata::Value #

Returns arg encoded as a ::Log::Metadata::Value.


[View source]