Snowflex.Transport.Http.Type (Snowflex v1.2.1)

View Source

Type conversions for REST transport.

See: https://docs.snowflake.com/en/developer-guide/sql-api/submitting-requests#using-bind-variables-in-a-statement

Summary

Types

Date as {year, month, day}

Datetime

Types that can be encoded for Snowflake

Output value.

Time as {hour, minute, sec, usec}

Type information for encoding/decoding

Functions

Transforms REST API return values to Elixir representations.

Transforms input params for the REST API. The REST API expects values in JSON format with type specified.

Types

date()

@type date() :: {1..9999, 1..12, 1..31}

Date as {year, month, day}

datetime()

@type datetime() :: {date(), time()}

Datetime

encodeable()

@type encodeable() ::
  boolean()
  | nil
  | integer()
  | float()
  | atom()
  | Decimal.t()
  | Date.t()
  | Time.t()
  | DateTime.t()
  | NaiveDateTime.t()
  | binary()

Types that can be encoded for Snowflake

encoded_value()

@type encoded_value() :: %{type: String.t(), value: String.t() | nil}

return_value()

@type return_value() :: bitstring() | integer() | date() | datetime() | Decimal.t()

Output value.

time()

@type time() :: {0..24, 0..60, 0..60, 0..999_999}

Time as {hour, minute, sec, usec}

type_info()

@type type_info() :: map()

Type information for encoding/decoding

Functions

decode(value, arg2)

@spec decode(nil, term()) :: nil
@spec decode(binary(), %{type: type_info()} | %{column: binary()}) :: return_value()

Transforms REST API return values to Elixir representations.

encode(param, _)

@spec encode(encodeable(), term()) :: encoded_value()

Transforms input params for the REST API. The REST API expects values in JSON format with type specified.

See: https://docs.snowflake.com/en/developer-guide/sql-api/submitting-requests#using-bind-variables-in-a-statement