pgx_sql_entity_graph/pg_extern/entity/argument.rs
1/*
2Portions Copyright 2019-2021 ZomboDB, LLC.
3Portions Copyright 2021-2022 Technology Concepts & Design, Inc. <support@tcdi.com>
4
5All rights reserved.
6
7Use of this source code is governed by the MIT license that can be found in the LICENSE file.
8*/
9/*!
10
11`#[pg_extern]` related argument entities for Rust to SQL translation
12
13> Like all of the [`sql_entity_graph`][crate::pgx_sql_entity_graph] APIs, this is considered **internal**
14to the `pgx` framework and very subject to change between versions. While you may use this, please do it with caution.
15
16*/
17use crate::{SqlGraphIdentifier, UsedTypeEntity};
18
19/// The output of a [`PgExternArgument`](crate::PgExternArgument) from `quote::ToTokens::to_tokens`.
20#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
21pub struct PgExternArgumentEntity {
22 pub pattern: &'static str,
23 pub used_ty: UsedTypeEntity,
24}
25
26impl SqlGraphIdentifier for PgExternArgumentEntity {
27 fn dot_identifier(&self) -> String {
28 format!("arg {}", self.rust_identifier())
29 }
30 fn rust_identifier(&self) -> String {
31 self.used_ty.full_path.to_string()
32 }
33
34 fn file(&self) -> Option<&'static str> {
35 None
36 }
37
38 fn line(&self) -> Option<u32> {
39 None
40 }
41}