pgrx_sql_entity_graph/metadata/entity.rs
1//LICENSE Portions Copyright 2019-2021 ZomboDB, LLC.
2//LICENSE
3//LICENSE Portions Copyright 2021-2023 Technology Concepts & Design, Inc.
4//LICENSE
5//LICENSE Portions Copyright 2023-2023 PgCentral Foundation, Inc. <contact@pgcentral.org>
6//LICENSE
7//LICENSE All rights reserved.
8//LICENSE
9//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
10/*!
11
12Function and type level metadata entities for Rust to SQL translation
13
14> Like all of the [`sql_entity_graph`][crate] APIs, this is considered **internal**
15> to the `pgrx` framework and very subject to change between versions. While you may use this, please do it with caution.
16
17
18*/
19use super::{ArgumentError, Returns, ReturnsError, SqlMapping};
20
21#[derive(Clone, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)]
22pub struct FunctionMetadataEntity {
23 pub arguments: Vec<FunctionMetadataTypeEntity>,
24 pub retval: FunctionMetadataTypeEntity,
25 pub path: &'static str,
26}
27
28#[derive(Clone, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)]
29pub struct FunctionMetadataTypeEntity {
30 pub type_name: &'static str,
31 pub argument_sql: Result<SqlMapping, ArgumentError>,
32 pub return_sql: Result<Returns, ReturnsError>,
33 pub variadic: bool,
34 pub optional: bool,
35}