First pass at uniformed types, specs and docs
- spec public functions (skipping controllers, views, live views and components) - use types instead of explanations in docs - remove redundant docs - fix typos
This commit is contained in:
@@ -4,16 +4,24 @@ defmodule SqliteVec.Ecto.Float32 do
|
||||
"""
|
||||
use Ecto.Type
|
||||
|
||||
@impl true
|
||||
@spec type() :: :binary
|
||||
def type, do: :binary
|
||||
|
||||
@impl true
|
||||
@spec cast(any()) :: {:ok, SqliteVec.Float32.t()}
|
||||
def cast(value) do
|
||||
{:ok, SqliteVec.Float32.new(value)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
@spec load(binary()) :: {:ok, SqliteVec.Float32.t()}
|
||||
def load(data) do
|
||||
{:ok, SqliteVec.Float32.from_binary(data)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
@spec dump(SqliteVec.Float32.t()) :: {:ok, binary()} | :error
|
||||
def dump(%SqliteVec.Float32{} = vector) do
|
||||
{:ok, SqliteVec.Float32.to_binary(vector)}
|
||||
end
|
||||
|
||||
@@ -75,6 +75,9 @@ defmodule SqliteVec.Ecto.Query do
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Matches a vector against a virtual table using the `match` operator.
|
||||
"""
|
||||
defmacro vec_match(a, b) do
|
||||
quote do
|
||||
fragment("? match ?", unquote(a), unquote(b))
|
||||
|
||||
Reference in New Issue
Block a user