ExDataSketch.Storage.Ecto.Schema (ExDataSketch v0.10.0)

Copy Markdown View Source

Ecto schema for the ex_data_sketch_sketches table.

This schema maps the persistence table used by ExDataSketch.Storage.Ecto. The table stores serialized EXSK v2 binary frames with the following columns:

  • id -- auto-incrementing primary key
  • key -- unique key for the sketch (string)
  • sketch_type -- the sketch family name (e.g., "hll", "cms")
  • data -- the serialized EXSK v2 binary frame
  • inserted_at -- timestamp of insertion
  • updated_at -- timestamp of last update

Dependency

This module requires the :ecto_sql package. If Ecto is not available, this module will not be compiled.

Usage

This module is used internally by ExDataSketch.Storage.Ecto. You should not need to interact with it directly. To create the table, use the migration generator:

mix ex_data_sketch.gen.migration --repo MyApp.Repo

Summary

Functions

Creates a changeset for a sketch record.

Types

t()

@type t() :: %ExDataSketch.Storage.Ecto.Schema{
  __meta__: term(),
  data: binary() | nil,
  id: integer() | nil,
  inserted_at: NaiveDateTime.t() | nil,
  key: String.t() | nil,
  sketch_type: String.t() | nil,
  updated_at: NaiveDateTime.t() | nil
}

Functions

changeset(schema, attrs)

@spec changeset(t(), map()) :: Ecto.Changeset.t()

Creates a changeset for a sketch record.

Arguments

  • schema -- an existing schema struct or %Schema{}.
  • attrs -- a map of attributes.

Returns

An Ecto.Changeset.