module Onyx::SQL::Converters::PG::UUID

Overview

Converts between the PostgreSQL's UUID type and Crystal's UUID. See Field to read about of how to apply converters.

CREATE EXTENSION pgcrypto;
CREATE TABLE users (
  uuid  UUID PRIMARY KEY  DEFAULT gen_random_uuid(),
);
require "onyx-sql/converters/pg/uuid"

class User
  include Onyx::SQL::Model

  schema do
    pkey uuid : UUID, converter: PG::UUID
  end
end

Defined in:

onyx-sql/converters/pg/uuid.cr

Class Method Summary

Class Method Detail

def self.from_rs(rs) : ::UUID? #

[View source]
def self.from_rs_array(rs) : ::Array(::UUID)? #

[View source]
def self.to_db(value : ::UUID) : DB::Any #

[View source]
def self.to_db(values : Enumerable(::UUID)) : DB::Any #

[View source]