pylon-db-core 0.1.0

The Pylon compiler: PyQL parsing, IR, SQL emission, schema export and migration diffing
Documentation
//
// This source file is part of the Pylon open source project.
//
// Copyright (c) 2026 Jaldis B.V.
//
// Licensed under the MIT OR Apache-2.0 license (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://opensource.org/licenses/MIT
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

use super::{E, f, p};
use super::{Float64, FnDescriptor, Vector};

pub(super) fn build() -> Vec<FnDescriptor> {
    vec![
        f(
            "pgvector",
            "euclidean_distance",
            vec![p("a", Vector), p("b", Vector)],
            Float64,
            E("($1 <-> $2)"),
        ),
        f(
            "pgvector",
            "cosine_distance",
            vec![p("a", Vector), p("b", Vector)],
            Float64,
            E("($1 <=> $2)"),
        ),
        f(
            "pgvector",
            "neg_inner_product",
            vec![p("a", Vector), p("b", Vector)],
            Float64,
            E("($1 <#> $2)"),
        ),
        f(
            "pgvector",
            "inner_product",
            vec![p("a", Vector), p("b", Vector)],
            Float64,
            E("(0.0 - ($1 <#> $2))"),
        ),
    ]
}