PostgresVectorCodec class final
Converts between the elements of a pgvector vector or halfvec column
and the text PostgREST carries them as.
PostgREST serializes these values as their Postgres literal,
[0.1,0.2,0.3], and accepts the same literal on insert and update.
postgresVector.encode([0.5, -2.25]) // [0.5,-2.25]
postgresVector.decode('[0.5,-2.25]') // [0.5, -2.25]
pgvector stores at least one finite element, so encode throws an
ArgumentError and decode a FormatException for an empty vector or
one holding NaN or an infinity.
The shared instance is postgresVector. Filters on and reads of the
pgvector columns of the postgrest package and the rows generated by
supabase_typegen go through it.
Constructors
- PostgresVectorCodec()
-
Creates the codec; prefer the shared postgresVector.
const
Properties
-
decoder
→ Converter<
String, List< double> > -
Returns the decoder of
this, converting fromTtoS.no setteroverride -
encoder
→ Converter<
List< double> , String> -
Returns the encoder from
StoT.no setteroverride - hashCode → int
-
The hash code for this object.
no setterinherited
-
inverted
→ Codec<
String, List< double> > -
Inverts
this.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
decode(
String encoded) → List< double> -
Decodes
encodeddata.inherited -
encode(
List< double> input) → String -
Encodes
input.inherited -
fuse<
R> (Codec< String, R> other) → Codec<List< double> , R> -
Fuses
thiswithother.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited