Electric.Replication.PostgresInterop.Casting (electric v1.0.24)

View Source

Summary

Functions

ilike?(text, pattern)

is_pg_int2(x)

(macro)

is_pg_int4(x)

(macro)

is_pg_int8(x)

(macro)

like?(text, pattern, ignore_case? \\ false)

LIKE function from SQL. Case sensitive by default.

Examples

iex> like?("hello", "hell_")
true

iex> like?("helloo", "hell_")
false

iex> like?("helloo", "%o_")
true

iex> like?("HELLO", "hello")
false

iex> like?("HELLO", "hello", true)
true

parse_bool(x)

parse_date(maybe_date)

parse_float8(input)

parse_int2(input)

parse_int4(input)

parse_int8(input)

parse_time(maybe_time)

parse_timestamp(maybe_timestamp)

parse_timestamptz(maybe_timestamp)

parse_uuid(maybe_uuid)

pg_and(a, b)

@spec pg_and(boolean() | nil, boolean() | nil) :: boolean() | nil

The Postgres AND operator, which has some specific behaviour when comparing NULLs with booleans.

Examples

iex> pg_and(true, true)
true

iex> pg_and(true, false)
false

iex> pg_and(false, false)
false

iex> pg_and(nil, true)
nil

iex> pg_and(nil, false)
false

iex> pg_and(nil, nil)
nil

pg_or(a, b)

@spec pg_or(boolean() | nil, boolean() | nil) :: boolean() | nil

The Postgres OR operator, which has some specific behaviour when comparing NULLs with booleans.

Examples

iex> pg_or(true, false)
true

iex> pg_or(false, false)
false

iex> pg_or(nil, true)
true

iex> pg_or(nil, false)
nil

iex> pg_or(nil, nil)
nil

values_distinct?(v1, v2, plain_comparison)

values_not_distinct?(v1, v2, plain_comparison)