id
stringlengths
11
116
type
stringclasses
1 value
granularity
stringclasses
4 values
content
stringlengths
16
477k
metadata
dict
fn_clm_diesel_models_find_by_merchant_id_subscription_id_6911544746515169423
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/subscription // Inherent implementation for Subscription pub async fn find_by_merchant_id_subscription_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, id: String, ) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::id.eq(id.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 40, "total_crates": null }
fn_clm_diesel_models_insert_-7820474190298348367
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/address // Inherent implementation for AddressNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Address> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_update_-7820474190298348367
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/address // Inherent implementation for Address pub async fn update( self, conn: &PgPooledConn, address_update_internal: AddressUpdateInternal, ) -> StorageResult<Self> { match generics::generic_update_with_unique_predicate_get_result::< <Self as HasTable>::Table, _, _, _, >( conn, dsl::address_id.eq(self.address_id.clone()), address_update_internal, ) .await { Err(error) => match error.current_context() { errors::DatabaseError::NoFieldsToUpdate => Ok(self), _ => Err(error), }, result => result, } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 93, "total_crates": null }
fn_clm_diesel_models_find_by_merchant_id_payment_id_address_id_-7820474190298348367
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/address // Inherent implementation for Address pub async fn find_by_merchant_id_payment_id_address_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, payment_id: &common_utils::id_type::PaymentId, address_id: &str, ) -> StorageResult<Self> { match generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::payment_id .eq(payment_id.to_owned()) .and(dsl::merchant_id.eq(merchant_id.to_owned())) .and(dsl::address_id.eq(address_id.to_owned())), ) .await { Err(error) => match error.current_context() { errors::DatabaseError::NotFound => { generics::generic_find_by_id::<<Self as HasTable>::Table, _, _>( conn, address_id.to_owned(), ) .await } _ => Err(error), }, result => result, } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 38, "total_crates": null }
fn_clm_diesel_models_update_by_merchant_id_customer_id_-7820474190298348367
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/address // Inherent implementation for Address pub async fn update_by_merchant_id_customer_id( conn: &PgPooledConn, customer_id: &common_utils::id_type::CustomerId, merchant_id: &common_utils::id_type::MerchantId, address: AddressUpdateInternal, ) -> StorageResult<Vec<Self>> { generics::generic_update_with_results::<<Self as HasTable>::Table, _, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::customer_id.eq(customer_id.to_owned())), address, ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_update_by_address_id_-7820474190298348367
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/address // Inherent implementation for Address pub async fn update_by_address_id( conn: &PgPooledConn, address_id: String, address: AddressUpdateInternal, ) -> StorageResult<Self> { match generics::generic_update_by_id::<<Self as HasTable>::Table, _, _, _>( conn, address_id.clone(), address, ) .await { Err(error) => match error.current_context() { errors::DatabaseError::NotFound => { Err(error.attach_printable("Address with the given ID doesn't exist")) } errors::DatabaseError::NoFieldsToUpdate => { generics::generic_find_by_id::<<Self as HasTable>::Table, _, _>( conn, address_id.clone(), ) .await } _ => Err(error), }, result => result, } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 26, "total_crates": null }
fn_clm_diesel_models_insert_-8332728313806060545
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/blocklist_lookup // Inherent implementation for BlocklistLookupNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<BlocklistLookup> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_find_by_merchant_id_fingerprint_-8332728313806060545
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/blocklist_lookup // Inherent implementation for BlocklistLookup pub async fn find_by_merchant_id_fingerprint( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, fingerprint: &str, ) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::fingerprint.eq(fingerprint.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_delete_by_merchant_id_fingerprint_-8332728313806060545
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/blocklist_lookup // Inherent implementation for BlocklistLookup pub async fn delete_by_merchant_id_fingerprint( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, fingerprint: &str, ) -> StorageResult<Self> { generics::generic_delete_one_with_result::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::fingerprint.eq(fingerprint.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_insert_-8029388340898359473
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/blocklist // Inherent implementation for BlocklistNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Blocklist> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_list_by_merchant_id_data_kind_-8029388340898359473
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/blocklist // Inherent implementation for Blocklist pub async fn list_by_merchant_id_data_kind( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, data_kind: common_enums::BlocklistDataKind, limit: i64, offset: i64, ) -> StorageResult<Vec<Self>> { generics::generic_filter::<<Self as HasTable>::Table, _, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::data_kind.eq(data_kind.to_owned())), Some(limit), Some(offset), Some(dsl::created_at.desc()), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 30, "total_crates": null }
fn_clm_diesel_models_find_by_merchant_id_fingerprint_id_-8029388340898359473
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/blocklist // Inherent implementation for Blocklist pub async fn find_by_merchant_id_fingerprint_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, fingerprint_id: &str, ) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::fingerprint_id.eq(fingerprint_id.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_delete_by_merchant_id_fingerprint_id_-8029388340898359473
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/blocklist // Inherent implementation for Blocklist pub async fn delete_by_merchant_id_fingerprint_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, fingerprint_id: &str, ) -> StorageResult<Self> { generics::generic_delete_one_with_result::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::fingerprint_id.eq(fingerprint_id.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_list_by_merchant_id_-8029388340898359473
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/blocklist // Inherent implementation for Blocklist pub async fn list_by_merchant_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult<Vec<Self>> { generics::generic_filter::<<Self as HasTable>::Table, _, _, _>( conn, dsl::merchant_id.eq(merchant_id.to_owned()), None, None, Some(dsl::created_at.desc()), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 24, "total_crates": null }
fn_clm_diesel_models_insert_-6369631672409294478
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/user // Inherent implementation for UserNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<User> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_find_users_by_user_ids_-6369631672409294478
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/user // Inherent implementation for User pub async fn find_users_by_user_ids( conn: &PgPooledConn, user_ids: Vec<String>, ) -> StorageResult<Vec<Self>> { generics::generic_filter::< <Self as HasTable>::Table, _, <<Self as HasTable>::Table as diesel::Table>::PrimaryKey, _, >(conn, users_dsl::user_id.eq_any(user_ids), None, None, None) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 26, "total_crates": null }
fn_clm_diesel_models_update_by_user_id_-6369631672409294478
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/user // Inherent implementation for User pub async fn update_by_user_id( conn: &PgPooledConn, user_id: &str, user_update: UserUpdate, ) -> StorageResult<Self> { generics::generic_update_with_unique_predicate_get_result::< <Self as HasTable>::Table, _, _, _, >( conn, users_dsl::user_id.eq(user_id.to_owned()), UserUpdateInternal::from(user_update), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 24, "total_crates": null }
fn_clm_diesel_models_update_by_user_email_-6369631672409294478
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/user // Inherent implementation for User pub async fn update_by_user_email( conn: &PgPooledConn, user_email: &pii::Email, user_update: UserUpdate, ) -> StorageResult<Self> { generics::generic_update_with_unique_predicate_get_result::< <Self as HasTable>::Table, _, _, _, >( conn, users_dsl::email.eq(user_email.to_owned()), UserUpdateInternal::from(user_update), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 24, "total_crates": null }
fn_clm_diesel_models_find_by_user_email_-6369631672409294478
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/user // Inherent implementation for User pub async fn find_by_user_email( conn: &PgPooledConn, user_email: &pii::Email, ) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, users_dsl::email.eq(user_email.to_owned()), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 22, "total_crates": null }
fn_clm_diesel_models_insert_7196457334079073518
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/user_role // Inherent implementation for UserRoleNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<UserRole> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_update_by_user_id_tenant_id_org_id_merchant_id_profile_id_7196457334079073518
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/user_role // Implementation of None for UserRole pub async fn update_by_user_id_tenant_id_org_id_merchant_id_profile_id( conn: &PgPooledConn, user_id: String, tenant_id: id_type::TenantId, org_id: id_type::OrganizationId, merchant_id: Option<id_type::MerchantId>, profile_id: Option<id_type::ProfileId>, update: UserRoleUpdate, version: UserRoleVersion, ) -> StorageResult<Self> { let check_lineage = dsl::tenant_id .eq(tenant_id.clone()) .and(dsl::org_id.is_null()) .and(dsl::merchant_id.is_null()) .and(dsl::profile_id.is_null()) .or( // Org-level condition dsl::tenant_id .eq(tenant_id.clone()) .and(dsl::org_id.eq(org_id.clone())) .and(dsl::merchant_id.is_null()) .and(dsl::profile_id.is_null()), ) .or( // Merchant-level condition dsl::tenant_id .eq(tenant_id.clone()) .and(dsl::org_id.eq(org_id.clone())) .and(dsl::merchant_id.eq(merchant_id.clone())) .and(dsl::profile_id.is_null()), ) .or( // Profile-level condition dsl::tenant_id .eq(tenant_id) .and(dsl::org_id.eq(org_id)) .and(dsl::merchant_id.eq(merchant_id)) .and(dsl::profile_id.eq(profile_id)), ); let predicate = dsl::user_id .eq(user_id) .and(check_lineage) .and(dsl::version.eq(version)); generics::generic_update_with_unique_predicate_get_result::< <Self as HasTable>::Table, UserRoleUpdateInternal, _, _, >(conn, predicate, update.into()) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 102, "total_crates": null }
fn_clm_diesel_models_check_user_in_lineage_7196457334079073518
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/user_role // Implementation of None for UserRole fn check_user_in_lineage( tenant_id: id_type::TenantId, org_id: Option<id_type::OrganizationId>, merchant_id: Option<id_type::MerchantId>, profile_id: Option<id_type::ProfileId>, ) -> Box< dyn diesel::BoxableExpression<<Self as HasTable>::Table, Pg, SqlType = Nullable<Bool>> + 'static, > { // Checking in user roles, for a user in token hierarchy, only one of the relations will be true: // either tenant level, org level, merchant level, or profile level // Tenant-level: (tenant_id = ? && org_id = null && merchant_id = null && profile_id = null) // Org-level: (org_id = ? && merchant_id = null && profile_id = null) // Merchant-level: (org_id = ? && merchant_id = ? && profile_id = null) // Profile-level: (org_id = ? && merchant_id = ? && profile_id = ?) Box::new( // Tenant-level condition dsl::tenant_id .eq(tenant_id.clone()) .and(dsl::org_id.is_null()) .and(dsl::merchant_id.is_null()) .and(dsl::profile_id.is_null()) .or( // Org-level condition dsl::tenant_id .eq(tenant_id.clone()) .and(dsl::org_id.eq(org_id.clone())) .and(dsl::merchant_id.is_null()) .and(dsl::profile_id.is_null()), ) .or( // Merchant-level condition dsl::tenant_id .eq(tenant_id.clone()) .and(dsl::org_id.eq(org_id.clone())) .and(dsl::merchant_id.eq(merchant_id.clone())) .and(dsl::profile_id.is_null()), ) .or( // Profile-level condition dsl::tenant_id .eq(tenant_id) .and(dsl::org_id.eq(org_id)) .and(dsl::merchant_id.eq(merchant_id)) .and(dsl::profile_id.eq(profile_id)), ), ) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 90, "total_crates": null }
fn_clm_diesel_models_generic_user_roles_list_for_user_7196457334079073518
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/user_role // Implementation of None for UserRole pub async fn generic_user_roles_list_for_user( conn: &PgPooledConn, user_id: String, tenant_id: id_type::TenantId, org_id: Option<id_type::OrganizationId>, merchant_id: Option<id_type::MerchantId>, profile_id: Option<id_type::ProfileId>, entity_id: Option<String>, status: Option<UserStatus>, version: Option<UserRoleVersion>, limit: Option<u32>, ) -> StorageResult<Vec<Self>> { let mut query = <Self as HasTable>::table() .filter(dsl::user_id.eq(user_id).and(dsl::tenant_id.eq(tenant_id))) .into_boxed(); if let Some(org_id) = org_id { query = query.filter(dsl::org_id.eq(org_id)); } if let Some(merchant_id) = merchant_id { query = query.filter(dsl::merchant_id.eq(merchant_id)); } if let Some(profile_id) = profile_id { query = query.filter(dsl::profile_id.eq(profile_id)); } if let Some(entity_id) = entity_id { query = query.filter(dsl::entity_id.eq(entity_id)); } if let Some(version) = version { query = query.filter(dsl::version.eq(version)); } if let Some(status) = status { query = query.filter(dsl::status.eq(status)); } if let Some(limit) = limit { query = query.limit(limit.into()); } router_env::logger::debug!(query = %debug_query::<Pg,_>(&query).to_string()); match generics::db_metrics::track_database_call::<Self, _, _>( query.get_results_async(conn), generics::db_metrics::DatabaseOperation::Filter, ) .await { Ok(value) => Ok(value), Err(err) => match err { DieselError::NotFound => { Err(report!(err)).change_context(errors::DatabaseError::NotFound) } _ => Err(report!(err)).change_context(errors::DatabaseError::Others), }, } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 64, "total_crates": null }
fn_clm_diesel_models_generic_user_roles_list_for_org_and_extra_7196457334079073518
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/user_role // Implementation of None for UserRole pub async fn generic_user_roles_list_for_org_and_extra( conn: &PgPooledConn, user_id: Option<String>, tenant_id: id_type::TenantId, org_id: id_type::OrganizationId, merchant_id: Option<id_type::MerchantId>, profile_id: Option<id_type::ProfileId>, version: Option<UserRoleVersion>, limit: Option<u32>, ) -> StorageResult<Vec<Self>> { let mut query = <Self as HasTable>::table() .filter(dsl::org_id.eq(org_id).and(dsl::tenant_id.eq(tenant_id))) .into_boxed(); if let Some(user_id) = user_id { query = query.filter(dsl::user_id.eq(user_id)); } if let Some(merchant_id) = merchant_id { query = query.filter(dsl::merchant_id.eq(merchant_id)); } if let Some(profile_id) = profile_id { query = query.filter(dsl::profile_id.eq(profile_id)); } if let Some(version) = version { query = query.filter(dsl::version.eq(version)); } if let Some(limit) = limit { query = query.limit(limit.into()); } router_env::logger::debug!(query = %debug_query::<Pg,_>(&query).to_string()); match generics::db_metrics::track_database_call::<Self, _, _>( query.get_results_async(conn), generics::db_metrics::DatabaseOperation::Filter, ) .await { Ok(value) => Ok(value), Err(err) => match err { DieselError::NotFound => { Err(report!(err)).change_context(errors::DatabaseError::NotFound) } _ => Err(report!(err)).change_context(errors::DatabaseError::Others), }, } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 56, "total_crates": null }
fn_clm_diesel_models_insert_7040775307514738649
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/locker_mock_up // Inherent implementation for LockerMockUpNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<LockerMockUp> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_find_by_card_id_7040775307514738649
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/locker_mock_up // Inherent implementation for LockerMockUp pub async fn find_by_card_id(conn: &PgPooledConn, card_id: &str) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::card_id.eq(card_id.to_owned()), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 22, "total_crates": null }
fn_clm_diesel_models_delete_by_card_id_7040775307514738649
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/locker_mock_up // Inherent implementation for LockerMockUp pub async fn delete_by_card_id(conn: &PgPooledConn, card_id: &str) -> StorageResult<Self> { generics::generic_delete_one_with_result::<<Self as HasTable>::Table, _, _>( conn, dsl::card_id.eq(card_id.to_owned()), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 22, "total_crates": null }
fn_clm_diesel_models_insert_5697639024689559771
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/refund // Inherent implementation for RefundNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Refund> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_update_5697639024689559771
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/refund // Implementation of None for Refund pub async fn update(self, conn: &PgPooledConn, refund: RefundUpdate) -> StorageResult<Self> { match generics::generic_update_with_unique_predicate_get_result::< <Self as HasTable>::Table, _, _, _, >( conn, dsl::refund_id .eq(self.refund_id.to_owned()) .and(dsl::merchant_id.eq(self.merchant_id.to_owned())), RefundUpdateInternal::from(refund), ) .await { Err(error) => match error.current_context() { errors::DatabaseError::NoFieldsToUpdate => Ok(self), _ => Err(error), }, result => result, } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 101, "total_crates": null }
fn_clm_diesel_models_find_by_merchant_id_connector_refund_id_connector_5697639024689559771
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/refund // Implementation of None for Refund pub async fn find_by_merchant_id_connector_refund_id_connector( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, connector_refund_id: &str, connector: &str, ) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::connector_refund_id.eq(connector_refund_id.to_owned())) .and(dsl::connector.eq(connector.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 34, "total_crates": null }
fn_clm_diesel_models_find_by_payment_id_merchant_id_5697639024689559771
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/refund // Implementation of None for Refund pub async fn find_by_payment_id_merchant_id( conn: &PgPooledConn, payment_id: &common_utils::id_type::PaymentId, merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult<Vec<Self>> { generics::generic_filter::< <Self as HasTable>::Table, _, <<Self as HasTable>::Table as Table>::PrimaryKey, _, >( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::payment_id.eq(payment_id.to_owned())), None, None, None, ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 31, "total_crates": null }
fn_clm_diesel_models_update_with_id_5697639024689559771
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/refund // Inherent implementation for Refund pub async fn update_with_id( self, conn: &PgPooledConn, refund: RefundUpdate, ) -> StorageResult<Self> { match generics::generic_update_by_id::<<Self as HasTable>::Table, _, _, _>( conn, self.id.to_owned(), RefundUpdateInternal::from(refund), ) .await { Err(error) => match error.current_context() { errors::DatabaseError::NoFieldsToUpdate => Ok(self), _ => Err(error), }, result => result, } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 30, "total_crates": null }
fn_clm_diesel_models_generic_insert_1829264814636338732
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/generics pub async fn generic_insert<T, V, R>(conn: &PgPooledConn, values: V) -> StorageResult<R> where T: HasTable<Table = T> + Table + 'static + Debug, V: Debug + Insertable<T>, <T as QuerySource>::FromClause: QueryFragment<Pg> + Debug, <V as Insertable<T>>::Values: CanInsertInSingleQuery<Pg> + QueryFragment<Pg> + 'static, InsertStatement<T, <V as Insertable<T>>::Values>: AsQuery + LoadQuery<'static, PgConnection, R> + Send, R: Send + 'static, { let debug_values = format!("{values:?}"); let query = diesel::insert_into(<T as HasTable>::table()).values(values); logger::debug!(query = %debug_query::<Pg, _>(&query).to_string()); match track_database_call::<T, _, _>(query.get_result_async(conn), DatabaseOperation::Insert) .await { Ok(value) => Ok(value), Err(err) => match err { DieselError::DatabaseError(diesel::result::DatabaseErrorKind::UniqueViolation, _) => { Err(report!(err)).change_context(errors::DatabaseError::UniqueViolation) } _ => Err(report!(err)).change_context(errors::DatabaseError::Others), }, } .attach_printable_lazy(|| format!("Error while inserting {debug_values}")) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 180, "total_crates": null }
fn_clm_diesel_models_generic_filter_1829264814636338732
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/generics pub(super) async fn generic_filter<T, P, O, R>( conn: &PgPooledConn, predicate: P, limit: Option<i64>, offset: Option<i64>, order: Option<O>, ) -> StorageResult<Vec<R>> where T: HasTable<Table = T> + Table + BoxedDsl<'static, Pg> + GetPrimaryKey + 'static, IntoBoxed<'static, T, Pg>: FilterDsl<P, Output = IntoBoxed<'static, T, Pg>> + FilterDsl<IsNotNull<T::PK>, Output = IntoBoxed<'static, T, Pg>> + LimitDsl<Output = IntoBoxed<'static, T, Pg>> + OffsetDsl<Output = IntoBoxed<'static, T, Pg>> + OrderDsl<O, Output = IntoBoxed<'static, T, Pg>> + LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send, O: Expression, R: Send + 'static, { let mut query = T::table().into_boxed(); query = query .filter(predicate) .filter(T::table().get_primary_key().is_not_null()); if let Some(limit) = limit { query = query.limit(limit); } if let Some(offset) = offset { query = query.offset(offset); } if let Some(order) = order { query = query.order(order); } logger::debug!(query = %debug_query::<Pg, _>(&query).to_string()); track_database_call::<T, _, _>(query.get_results_async(conn), DatabaseOperation::Filter) .await .change_context(errors::DatabaseError::Others) .attach_printable("Error filtering records by predicate") }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 36, "total_crates": null }
fn_clm_diesel_models_generic_update_by_id_1829264814636338732
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/generics pub async fn generic_update_by_id<T, V, Pk, R>( conn: &PgPooledConn, id: Pk, values: V, ) -> StorageResult<R> where T: FindDsl<Pk> + HasTable<Table = T> + LimitDsl + Table + 'static, V: AsChangeset<Target = <Find<T, Pk> as HasTable>::Table> + Debug, Find<T, Pk>: IntoUpdateTarget + QueryFragment<Pg> + RunQueryDsl<PgConnection> + Send + 'static, UpdateStatement< <Find<T, Pk> as HasTable>::Table, <Find<T, Pk> as IntoUpdateTarget>::WhereClause, <V as AsChangeset>::Changeset, >: AsQuery + LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send + 'static, Find<T, Pk>: LimitDsl, Limit<Find<T, Pk>>: LoadQuery<'static, PgConnection, R>, R: Send + 'static, Pk: Clone + Debug, // For cloning query (UpdateStatement) <Find<T, Pk> as HasTable>::Table: Clone, <Find<T, Pk> as IntoUpdateTarget>::WhereClause: Clone, <V as AsChangeset>::Changeset: Clone, <<Find<T, Pk> as HasTable>::Table as QuerySource>::FromClause: Clone, { let debug_values = format!("{values:?}"); let query = diesel::update(<T as HasTable>::table().find(id.to_owned())).set(values); match track_database_call::<T, _, _>( query.to_owned().get_result_async(conn), DatabaseOperation::UpdateOne, ) .await { Ok(result) => { logger::debug!(query = %debug_query::<Pg, _>(&query).to_string()); Ok(result) } Err(DieselError::QueryBuilderError(_)) => { Err(report!(errors::DatabaseError::NoFieldsToUpdate)) .attach_printable_lazy(|| format!("Error while updating by ID {debug_values}")) } Err(DieselError::NotFound) => Err(report!(errors::DatabaseError::NotFound)) .attach_printable_lazy(|| format!("Error while updating by ID {debug_values}")), Err(error) => Err(error) .change_context(errors::DatabaseError::Others) .attach_printable_lazy(|| format!("Error while updating by ID {debug_values}")), } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 32, "total_crates": null }
fn_clm_diesel_models_generic_delete_one_with_result_1829264814636338732
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/generics pub async fn generic_delete_one_with_result<T, P, R>( conn: &PgPooledConn, predicate: P, ) -> StorageResult<R> where T: FilterDsl<P> + HasTable<Table = T> + Table + 'static, Filter<T, P>: IntoUpdateTarget, DeleteStatement< <Filter<T, P> as HasTable>::Table, <Filter<T, P> as IntoUpdateTarget>::WhereClause, >: AsQuery + LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send + 'static, R: Send + Clone + 'static, { let query = diesel::delete(<T as HasTable>::table().filter(predicate)); logger::debug!(query = %debug_query::<Pg, _>(&query).to_string()); track_database_call::<T, _, _>( query.get_results_async(conn), DatabaseOperation::DeleteWithResult, ) .await .change_context(errors::DatabaseError::Others) .attach_printable("Error while deleting") .and_then(|result| { result.first().cloned().ok_or_else(|| { report!(errors::DatabaseError::NotFound) .attach_printable("Object to be deleted does not exist") }) }) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 32, "total_crates": null }
fn_clm_diesel_models_generic_update_with_results_1829264814636338732
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/generics pub async fn generic_update_with_results<T, V, P, R>( conn: &PgPooledConn, predicate: P, values: V, ) -> StorageResult<Vec<R>> where T: FilterDsl<P> + HasTable<Table = T> + Table + 'static, V: AsChangeset<Target = <Filter<T, P> as HasTable>::Table> + Debug + 'static, Filter<T, P>: IntoUpdateTarget + 'static, UpdateStatement< <Filter<T, P> as HasTable>::Table, <Filter<T, P> as IntoUpdateTarget>::WhereClause, <V as AsChangeset>::Changeset, >: AsQuery + LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send + Clone, R: Send + 'static, // For cloning query (UpdateStatement) <Filter<T, P> as HasTable>::Table: Clone, <Filter<T, P> as IntoUpdateTarget>::WhereClause: Clone, <V as AsChangeset>::Changeset: Clone, <<Filter<T, P> as HasTable>::Table as QuerySource>::FromClause: Clone, { let debug_values = format!("{values:?}"); let query = diesel::update(<T as HasTable>::table().filter(predicate)).set(values); match track_database_call::<T, _, _>( query.to_owned().get_results_async(conn), DatabaseOperation::UpdateWithResults, ) .await { Ok(result) => { logger::debug!(query = %debug_query::<Pg, _>(&query).to_string()); Ok(result) } Err(DieselError::QueryBuilderError(_)) => { Err(report!(errors::DatabaseError::NoFieldsToUpdate)) .attach_printable_lazy(|| format!("Error while updating {debug_values}")) } Err(DieselError::NotFound) => Err(report!(errors::DatabaseError::NotFound)) .attach_printable_lazy(|| format!("Error while updating {debug_values}")), Err(error) => Err(error) .change_context(errors::DatabaseError::Others) .attach_printable_lazy(|| format!("Error while updating {debug_values}")), } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 30, "total_crates": null }
fn_clm_diesel_models_update_12722640348227062
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/process_tracker // Inherent implementation for ProcessTracker pub async fn update( self, conn: &PgPooledConn, process: ProcessTrackerUpdate, ) -> StorageResult<Self> { match generics::generic_update_by_id::<<Self as HasTable>::Table, _, _, _>( conn, self.id.clone(), ProcessTrackerUpdateInternal::from(process), ) .await { Err(error) => match error.current_context() { errors::DatabaseError::NoFieldsToUpdate => Ok(self), _ => Err(error), }, result => result, } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 93, "total_crates": null }
fn_clm_diesel_models_insert_process_12722640348227062
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/process_tracker // Inherent implementation for ProcessTrackerNew pub async fn insert_process(self, conn: &PgPooledConn) -> StorageResult<ProcessTracker> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 74, "total_crates": null }
fn_clm_diesel_models_find_process_by_id_12722640348227062
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/process_tracker // Inherent implementation for ProcessTracker pub async fn find_process_by_id(conn: &PgPooledConn, id: &str) -> StorageResult<Option<Self>> { generics::generic_find_by_id_optional::<<Self as HasTable>::Table, _, _>( conn, id.to_owned(), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 62, "total_crates": null }
fn_clm_diesel_models_find_processes_by_time_status_12722640348227062
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/process_tracker // Inherent implementation for ProcessTracker pub async fn find_processes_by_time_status( conn: &PgPooledConn, time_lower_limit: PrimitiveDateTime, time_upper_limit: PrimitiveDateTime, status: enums::ProcessTrackerStatus, limit: Option<i64>, version: enums::ApiVersion, ) -> StorageResult<Vec<Self>> { generics::generic_filter::< <Self as HasTable>::Table, _, <<Self as HasTable>::Table as Table>::PrimaryKey, _, >( conn, dsl::schedule_time .between(time_lower_limit, time_upper_limit) .and(dsl::status.eq(status)) .and(dsl::version.eq(version)), limit, None, None, ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 37, "total_crates": null }
fn_clm_diesel_models_find_processes_to_clean_12722640348227062
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/process_tracker // Inherent implementation for ProcessTracker pub async fn find_processes_to_clean( conn: &PgPooledConn, time_lower_limit: PrimitiveDateTime, time_upper_limit: PrimitiveDateTime, runner: &str, limit: usize, ) -> StorageResult<Vec<Self>> { let mut x: Vec<Self> = generics::generic_filter::< <Self as HasTable>::Table, _, <<Self as HasTable>::Table as Table>::PrimaryKey, _, >( conn, dsl::schedule_time .between(time_lower_limit, time_upper_limit) .and(dsl::status.eq(enums::ProcessTrackerStatus::ProcessStarted)) .and(dsl::runner.eq(runner.to_owned())), None, None, None, ) .await?; x.sort_by(|a, b| a.schedule_time.cmp(&b.schedule_time)); x.truncate(limit); Ok(x) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 36, "total_crates": null }
fn_clm_diesel_models_insert_7389933901177548426
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/business_profile // Inherent implementation for ProfileNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Profile> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_list_profile_by_merchant_id_7389933901177548426
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/business_profile // Inherent implementation for Profile pub async fn list_profile_by_merchant_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult<Vec<Self>> { generics::generic_filter::< <Self as HasTable>::Table, _, <<Self as HasTable>::Table as Table>::PrimaryKey, _, >( conn, dsl::merchant_id.eq(merchant_id.to_owned()), None, None, None, ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 52, "total_crates": null }
fn_clm_diesel_models_find_by_merchant_id_profile_id_7389933901177548426
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/business_profile // Inherent implementation for Profile pub async fn find_by_merchant_id_profile_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, profile_id: &common_utils::id_type::ProfileId, ) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl_identifier.eq(profile_id.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_find_by_profile_name_merchant_id_7389933901177548426
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/business_profile // Inherent implementation for Profile pub async fn find_by_profile_name_merchant_id( conn: &PgPooledConn, profile_name: &str, merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::profile_name .eq(profile_name.to_owned()) .and(dsl::merchant_id.eq(merchant_id.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_delete_by_profile_id_merchant_id_7389933901177548426
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/business_profile // Inherent implementation for Profile pub async fn delete_by_profile_id_merchant_id( conn: &PgPooledConn, profile_id: &common_utils::id_type::ProfileId, merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult<bool> { generics::generic_delete::<<Self as HasTable>::Table, _>( conn, dsl_identifier .eq(profile_id.to_owned()) .and(dsl::merchant_id.eq(merchant_id.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_insert_-7413955872300256182
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/payment_link // Inherent implementation for PaymentLinkNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<PaymentLink> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_find_link_by_payment_link_id_-7413955872300256182
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/payment_link // Inherent implementation for PaymentLink pub async fn find_link_by_payment_link_id( conn: &PgPooledConn, payment_link_id: &str, ) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::payment_link_id.eq(payment_link_id.to_owned()), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 22, "total_crates": null }
fn_clm_diesel_models_insert_-9164069118273016605
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/invoice // Inherent implementation for InvoiceNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Invoice> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_list_invoices_by_subscription_id_-9164069118273016605
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/invoice // Inherent implementation for Invoice pub async fn list_invoices_by_subscription_id( conn: &PgPooledConn, subscription_id: String, limit: Option<i64>, offset: Option<i64>, order_by_ascending_order: bool, ) -> StorageResult<Vec<Self>> { if order_by_ascending_order { generics::generic_filter::<<Self as HasTable>::Table, _, _, _>( conn, dsl::subscription_id.eq(subscription_id.to_owned()), limit, offset, Some(dsl::created_at.asc()), ) .await } else { generics::generic_filter::<<Self as HasTable>::Table, _, _, _>( conn, dsl::subscription_id.eq(subscription_id.to_owned()), limit, offset, Some(dsl::created_at.desc()), ) .await } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 30, "total_crates": null }
fn_clm_diesel_models_update_invoice_entry_-9164069118273016605
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/invoice // Inherent implementation for Invoice pub async fn update_invoice_entry( conn: &PgPooledConn, id: String, invoice_update: InvoiceUpdate, ) -> StorageResult<Self> { generics::generic_update_with_unique_predicate_get_result::< <Self as HasTable>::Table, _, _, _, >(conn, dsl::id.eq(id.to_owned()), invoice_update) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_get_invoice_by_subscription_id_connector_invoice_id_-9164069118273016605
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/invoice // Inherent implementation for Invoice pub async fn get_invoice_by_subscription_id_connector_invoice_id( conn: &PgPooledConn, subscription_id: String, connector_invoice_id: common_utils::id_type::InvoiceId, ) -> StorageResult<Option<Self>> { generics::generic_find_one_optional::<<Self as HasTable>::Table, _, _>( conn, dsl::subscription_id .eq(subscription_id.to_owned()) .and(dsl::connector_invoice_id.eq(connector_invoice_id.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_find_invoice_by_id_invoice_id_-9164069118273016605
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/invoice // Inherent implementation for Invoice pub async fn find_invoice_by_id_invoice_id( conn: &PgPooledConn, id: String, ) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::id.eq(id.to_owned()), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 22, "total_crates": null }
fn_clm_diesel_models_try_from_160329865856271061
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/generic_link // Implementation of PayoutLink for TryFrom<GenericLink> fn try_from(db_val: GenericLink) -> Result<Self, Self::Error> { let (link_data, link_status) = match db_val.link_type { common_enums::GenericLinkType::PayoutLink => { let link_data = db_val.link_data.parse_value("PayoutLinkData")?; let link_status = match db_val.link_status { GenericLinkStatus::PayoutLink(status) => Ok(status), _ => Err(report!(errors::ParsingError::EnumParseFailure( "GenericLinkStatus" ))) .attach_printable_lazy(|| { format!("Invalid status for PayoutLink - {:?}", db_val.link_status) }), }?; (link_data, link_status) } _ => Err(report!(errors::ParsingError::UnknownError)).attach_printable_lazy(|| { format!("Invalid link_type for PayoutLink - {}", db_val.link_type) })?, }; Ok(Self { link_id: db_val.link_id, primary_reference: common_utils::id_type::PayoutId::try_from(std::borrow::Cow::Owned( db_val.primary_reference, )) .change_context(errors::ParsingError::UnknownError) .attach_printable("Failed to parse PayoutId from primary_reference string")?, merchant_id: db_val.merchant_id, created_at: db_val.created_at, last_modified_at: db_val.last_modified_at, expiry: db_val.expiry, link_data, link_status, link_type: db_val.link_type, url: db_val.url, return_url: db_val.return_url, }) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2671, "total_crates": null }
fn_clm_diesel_models_insert_160329865856271061
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/generic_link // Inherent implementation for GenericLinkNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<GenericLinkState> { generics::generic_insert(conn, self) .await .and_then(|res: GenericLink| { GenericLinkState::try_from(res) .change_context(db_errors::DatabaseError::Others) .attach_printable("failed to parse generic link data from DB") }) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1135, "total_crates": null }
fn_clm_diesel_models_update_payout_link_160329865856271061
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/generic_link // Inherent implementation for PayoutLink pub async fn update_payout_link( self, conn: &PgPooledConn, payout_link_update: PayoutLinkUpdate, ) -> StorageResult<Self> { generics::generic_update_with_results::<<Self as HasTable>::Table, _, _, _>( conn, dsl::link_id.eq(self.link_id.to_owned()), GenericLinkUpdateInternal::from(payout_link_update), ) .await .and_then(|mut payout_links| { payout_links .pop() .ok_or(error_stack::report!(db_errors::DatabaseError::NotFound)) }) .or_else(|error| match error.current_context() { db_errors::DatabaseError::NoFieldsToUpdate => Ok(self), _ => Err(error), }) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 43, "total_crates": null }
fn_clm_diesel_models_find_payout_link_by_link_id_160329865856271061
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/generic_link // Inherent implementation for GenericLink pub async fn find_payout_link_by_link_id( conn: &PgPooledConn, link_id: &str, ) -> StorageResult<PayoutLink> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::link_id.eq(link_id.to_owned()), ) .await .and_then(|res: Self| { PayoutLink::try_from(res) .change_context(db_errors::DatabaseError::Others) .attach_printable("failed to parse payout link data from DB") }) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 39, "total_crates": null }
fn_clm_diesel_models_find_pm_collect_link_by_link_id_160329865856271061
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/generic_link // Inherent implementation for GenericLink pub async fn find_pm_collect_link_by_link_id( conn: &PgPooledConn, link_id: &str, ) -> StorageResult<PaymentMethodCollectLink> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::link_id.eq(link_id.to_owned()), ) .await .and_then(|res: Self| { PaymentMethodCollectLink::try_from(res) .change_context(db_errors::DatabaseError::Others) .attach_printable("failed to parse payment method collect link data from DB") }) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 36, "total_crates": null }
fn_clm_diesel_models_insert_-3741399560260973218
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/unified_translations // Inherent implementation for UnifiedTranslationsNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<UnifiedTranslations> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_update_by_unified_code_unified_message_locale_-3741399560260973218
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/unified_translations // Inherent implementation for UnifiedTranslations pub async fn update_by_unified_code_unified_message_locale( conn: &PgPooledConn, unified_code: String, unified_message: String, locale: String, data: UnifiedTranslationsUpdate, ) -> StorageResult<Self> { generics::generic_update_with_results::< <Self as HasTable>::Table, UnifiedTranslationsUpdateInternal, _, _, >( conn, dsl::unified_code .eq(unified_code) .and(dsl::unified_message.eq(unified_message)) .and(dsl::locale.eq(locale)), data.into(), ) .await? .first() .cloned() .ok_or_else(|| { report!(errors::DatabaseError::NotFound) .attach_printable("Error while updating unified_translations entry") }) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 38, "total_crates": null }
fn_clm_diesel_models_find_by_unified_code_unified_message_locale_-3741399560260973218
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/unified_translations // Inherent implementation for UnifiedTranslations pub async fn find_by_unified_code_unified_message_locale( conn: &PgPooledConn, unified_code: String, unified_message: String, locale: String, ) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::unified_code .eq(unified_code) .and(dsl::unified_message.eq(unified_message)) .and(dsl::locale.eq(locale)), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_delete_by_unified_code_unified_message_locale_-3741399560260973218
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/unified_translations // Inherent implementation for UnifiedTranslations pub async fn delete_by_unified_code_unified_message_locale( conn: &PgPooledConn, unified_code: String, unified_message: String, locale: String, ) -> StorageResult<bool> { generics::generic_delete::<<Self as HasTable>::Table, _>( conn, dsl::unified_code .eq(unified_code) .and(dsl::unified_message.eq(unified_message)) .and(dsl::locale.eq(locale)), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_insert_-8769803011572845790
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/api_keys // Inherent implementation for ApiKeyNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<ApiKey> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_update_by_merchant_id_key_id_-8769803011572845790
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/api_keys // Inherent implementation for ApiKey pub async fn update_by_merchant_id_key_id( conn: &PgPooledConn, merchant_id: common_utils::id_type::MerchantId, key_id: common_utils::id_type::ApiKeyId, api_key_update: ApiKeyUpdate, ) -> StorageResult<Self> { match generics::generic_update_with_unique_predicate_get_result::< <Self as HasTable>::Table, _, _, _, >( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::key_id.eq(key_id.to_owned())), ApiKeyUpdateInternal::from(api_key_update), ) .await { Err(error) => match error.current_context() { errors::DatabaseError::NotFound => { Err(error.attach_printable("API key with the given key ID does not exist")) } errors::DatabaseError::NoFieldsToUpdate => { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::key_id.eq(key_id.to_owned())), ) .await } _ => Err(error), }, result => result, } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 44, "total_crates": null }
fn_clm_diesel_models_revoke_by_merchant_id_key_id_-8769803011572845790
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/api_keys // Inherent implementation for ApiKey pub async fn revoke_by_merchant_id_key_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, key_id: &common_utils::id_type::ApiKeyId, ) -> StorageResult<bool> { generics::generic_delete::<<Self as HasTable>::Table, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::key_id.eq(key_id.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_find_optional_by_merchant_id_key_id_-8769803011572845790
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/api_keys // Inherent implementation for ApiKey pub async fn find_optional_by_merchant_id_key_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, key_id: &common_utils::id_type::ApiKeyId, ) -> StorageResult<Option<Self>> { generics::generic_find_one_optional::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::key_id.eq(key_id.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_find_by_merchant_id_-8769803011572845790
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/api_keys // Inherent implementation for ApiKey pub async fn find_by_merchant_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, limit: Option<i64>, offset: Option<i64>, ) -> StorageResult<Vec<Self>> { generics::generic_filter::<<Self as HasTable>::Table, _, _, _>( conn, dsl::merchant_id.eq(merchant_id.to_owned()), limit, offset, Some(dsl::created_at.asc()), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 24, "total_crates": null }
fn_clm_diesel_models_insert_7238602821207859815
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/dashboard_metadata // Inherent implementation for DashboardMetadataNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<DashboardMetadata> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_update_7238602821207859815
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/dashboard_metadata // Inherent implementation for DashboardMetadata pub async fn update( conn: &PgPooledConn, user_id: Option<String>, merchant_id: id_type::MerchantId, org_id: id_type::OrganizationId, data_key: enums::DashboardMetadata, dashboard_metadata_update: DashboardMetadataUpdate, ) -> StorageResult<Self> { let predicate = dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::org_id.eq(org_id.to_owned())) .and(dsl::data_key.eq(data_key.to_owned())); if let Some(uid) = user_id { generics::generic_update_with_unique_predicate_get_result::< <Self as HasTable>::Table, _, _, _, >( conn, predicate.and(dsl::user_id.eq(uid)), DashboardMetadataUpdateInternal::from(dashboard_metadata_update), ) .await } else { generics::generic_update_with_unique_predicate_get_result::< <Self as HasTable>::Table, _, _, _, >( conn, predicate.and(dsl::user_id.is_null()), DashboardMetadataUpdateInternal::from(dashboard_metadata_update), ) .await } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 115, "total_crates": null }
fn_clm_diesel_models_find_user_scoped_dashboard_metadata_7238602821207859815
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/dashboard_metadata // Inherent implementation for DashboardMetadata pub async fn find_user_scoped_dashboard_metadata( conn: &PgPooledConn, user_id: String, merchant_id: id_type::MerchantId, org_id: id_type::OrganizationId, data_types: Vec<enums::DashboardMetadata>, ) -> StorageResult<Vec<Self>> { let predicate = dsl::user_id .eq(user_id) .and(dsl::merchant_id.eq(merchant_id)) .and(dsl::org_id.eq(org_id)) .and(dsl::data_key.eq_any(data_types)); generics::generic_filter::<<Self as HasTable>::Table, _, _, _>( conn, predicate, None, None, Some(dsl::last_modified_at.asc()), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 40, "total_crates": null }
fn_clm_diesel_models_find_merchant_scoped_dashboard_metadata_7238602821207859815
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/dashboard_metadata // Inherent implementation for DashboardMetadata pub async fn find_merchant_scoped_dashboard_metadata( conn: &PgPooledConn, merchant_id: id_type::MerchantId, org_id: id_type::OrganizationId, data_types: Vec<enums::DashboardMetadata>, ) -> StorageResult<Vec<Self>> { let predicate = dsl::merchant_id .eq(merchant_id) .and(dsl::org_id.eq(org_id)) .and(dsl::data_key.eq_any(data_types)); generics::generic_filter::<<Self as HasTable>::Table, _, _, _>( conn, predicate, None, None, Some(dsl::last_modified_at.asc()), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 36, "total_crates": null }
fn_clm_diesel_models_delete_user_scoped_dashboard_metadata_by_merchant_id_data_key_7238602821207859815
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/dashboard_metadata // Inherent implementation for DashboardMetadata pub async fn delete_user_scoped_dashboard_metadata_by_merchant_id_data_key( conn: &PgPooledConn, user_id: String, merchant_id: id_type::MerchantId, data_key: enums::DashboardMetadata, ) -> StorageResult<Self> { generics::generic_delete_one_with_result::<<Self as HasTable>::Table, _, _>( conn, dsl::user_id .eq(user_id) .and(dsl::merchant_id.eq(merchant_id)) .and(dsl::data_key.eq(data_key)), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 34, "total_crates": null }
fn_clm_diesel_models_insert_-4115178819790970935
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/customers // Inherent implementation for CustomerNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Customer> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_get_customer_count_by_merchant_id_and_constraints_-4115178819790970935
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/customers // Inherent implementation for Customer pub async fn get_customer_count_by_merchant_id_and_constraints( conn: &PgPooledConn, merchant_id: &id_type::MerchantId, customer_list_constraints: CustomerListConstraints, ) -> StorageResult<usize> { if let Some(customer_id) = customer_list_constraints.customer_id { let predicate = dsl::merchant_id .eq(merchant_id.clone()) .and(dsl::merchant_reference_id.eq(customer_id)); generics::generic_count::<<Self as HasTable>::Table, _>(conn, predicate).await } else if let Some(time_range) = customer_list_constraints.time_range { let start_time = time_range.start_time; let end_time = time_range .end_time .unwrap_or_else(common_utils::date_time::now); let predicate = dsl::merchant_id .eq(merchant_id.clone()) .and(dsl::created_at.between(start_time, end_time)); generics::generic_count::<<Self as HasTable>::Table, _>(conn, predicate).await } else { generics::generic_count::<<Self as HasTable>::Table, _>( conn, dsl::merchant_id.eq(merchant_id.to_owned()), ) .await } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 40, "total_crates": null }
fn_clm_diesel_models_list_customers_by_merchant_id_and_constraints_-4115178819790970935
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/customers // Inherent implementation for Customer pub async fn list_customers_by_merchant_id_and_constraints( conn: &PgPooledConn, merchant_id: &id_type::MerchantId, constraints: CustomerListConstraints, ) -> StorageResult<Vec<Self>> { if let Some(customer_id) = constraints.customer_id { let predicate = dsl::merchant_id .eq(merchant_id.clone()) .and(dsl::merchant_reference_id.eq(customer_id)); generics::generic_filter::<<Self as HasTable>::Table, _, _, Self>( conn, predicate, Some(constraints.limit), constraints.offset, Some(dsl::created_at), ) .await } else if let Some(time_range) = constraints.time_range { let start_time = time_range.start_time; let end_time = time_range .end_time .unwrap_or_else(common_utils::date_time::now); let predicate = dsl::merchant_id .eq(merchant_id.clone()) .and(dsl::created_at.between(start_time, end_time)); generics::generic_filter::<<Self as HasTable>::Table, _, _, Self>( conn, predicate, Some(constraints.limit), constraints.offset, Some(dsl::created_at), ) .await } else { let predicate = dsl::merchant_id.eq(merchant_id.clone()); generics::generic_filter::<<Self as HasTable>::Table, _, _, Self>( conn, predicate, Some(constraints.limit), constraints.offset, Some(dsl::created_at), ) .await } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 40, "total_crates": null }
fn_clm_diesel_models_find_optional_by_merchant_id_merchant_reference_id_-4115178819790970935
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/customers // Inherent implementation for Customer pub async fn find_optional_by_merchant_id_merchant_reference_id( conn: &PgPooledConn, customer_id: &id_type::CustomerId, merchant_id: &id_type::MerchantId, ) -> StorageResult<Option<Self>> { generics::generic_find_one_optional::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::merchant_reference_id.eq(customer_id.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 31, "total_crates": null }
fn_clm_diesel_models_delete_by_customer_id_merchant_id_-4115178819790970935
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/customers // Inherent implementation for Customer pub async fn delete_by_customer_id_merchant_id( conn: &PgPooledConn, customer_id: &id_type::CustomerId, merchant_id: &id_type::MerchantId, ) -> StorageResult<bool> { generics::generic_delete::<<Self as HasTable>::Table, _>( conn, dsl::customer_id .eq(customer_id.to_owned()) .and(dsl::merchant_id.eq(merchant_id.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_insert_1300033066689334182
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/gsm // Inherent implementation for GatewayStatusMappingNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<GatewayStatusMap> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_find_1300033066689334182
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/gsm // Inherent implementation for GatewayStatusMap pub async fn find( conn: &PgPooledConn, connector: String, flow: String, sub_flow: String, code: String, message: String, ) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::connector .eq(connector) .and(dsl::flow.eq(flow)) .and(dsl::sub_flow.eq(sub_flow)) .and(dsl::code.eq(code)) .and(dsl::message.eq(message)), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 393, "total_crates": null }
fn_clm_diesel_models_update_1300033066689334182
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/gsm // Inherent implementation for GatewayStatusMap pub async fn update( conn: &PgPooledConn, connector: String, flow: String, sub_flow: String, code: String, message: String, gsm: GatewayStatusMappingUpdate, ) -> StorageResult<Self> { generics::generic_update_with_results::< <Self as HasTable>::Table, GatewayStatusMapperUpdateInternal, _, _, >( conn, dsl::connector .eq(connector) .and(dsl::flow.eq(flow)) .and(dsl::sub_flow.eq(sub_flow)) .and(dsl::code.eq(code)) .and(dsl::message.eq(message)), gsm.into(), ) .await? .first() .cloned() .ok_or_else(|| { report!(errors::DatabaseError::NotFound) .attach_printable("Error while updating gsm entry") }) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 115, "total_crates": null }
fn_clm_diesel_models_delete_1300033066689334182
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/gsm // Inherent implementation for GatewayStatusMap pub async fn delete( conn: &PgPooledConn, connector: String, flow: String, sub_flow: String, code: String, message: String, ) -> StorageResult<bool> { generics::generic_delete::<<Self as HasTable>::Table, _>( conn, dsl::connector .eq(connector) .and(dsl::flow.eq(flow)) .and(dsl::sub_flow.eq(sub_flow)) .and(dsl::code.eq(code)) .and(dsl::message.eq(message)), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 66, "total_crates": null }
fn_clm_diesel_models_retrieve_decision_1300033066689334182
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/gsm // Inherent implementation for GatewayStatusMap pub async fn retrieve_decision( conn: &PgPooledConn, connector: String, flow: String, sub_flow: String, code: String, message: String, ) -> StorageResult<String> { Self::find(conn, connector, flow, sub_flow, code, message) .await .map(|item| item.decision) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 22, "total_crates": null }
fn_clm_diesel_models_insert_-9004894734119123124
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/connector_response // Inherent implementation for ConnectorResponseNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<ConnectorResponse> { let payment_attempt_update = PaymentAttemptUpdate::ConnectorResponse { authentication_data: self.authentication_data.clone(), encoded_data: self.encoded_data.clone(), connector_transaction_id: self.connector_transaction_id.clone(), connector: self.connector_name.clone(), updated_by: self.updated_by.clone(), charge_id: self.charge_id.clone(), }; let _payment_attempt: Result<PaymentAttempt, _> = generics::generic_update_with_unique_predicate_get_result::< <PaymentAttempt as HasTable>::Table, _, _, _, >( conn, pa_dsl::attempt_id .eq(self.attempt_id.to_owned()) .and(pa_dsl::merchant_id.eq(self.merchant_id.to_owned())), PaymentAttemptUpdateInternal::from(payment_attempt_update), ) .await .inspect_err(|err| { logger::error!( "Error while updating payment attempt in connector_response flow {:?}", err ); }); generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1153, "total_crates": null }
fn_clm_diesel_models_update_-9004894734119123124
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/connector_response // Inherent implementation for ConnectorResponse pub async fn update( self, conn: &PgPooledConn, connector_response: ConnectorResponseUpdate, ) -> StorageResult<Self> { let payment_attempt_update = match connector_response.clone() { ConnectorResponseUpdate::ResponseUpdate { connector_transaction_id, authentication_data, encoded_data, connector_name, charge_id, updated_by, } => PaymentAttemptUpdate::ConnectorResponse { authentication_data, encoded_data, connector_transaction_id, connector: connector_name, charge_id, updated_by, }, ConnectorResponseUpdate::ErrorUpdate { connector_name, updated_by, } => PaymentAttemptUpdate::ConnectorResponse { authentication_data: None, encoded_data: None, connector_transaction_id: None, connector: connector_name, charge_id: None, updated_by, }, }; let _payment_attempt: Result<PaymentAttempt, _> = generics::generic_update_with_unique_predicate_get_result::< <PaymentAttempt as HasTable>::Table, _, _, _, >( conn, pa_dsl::attempt_id .eq(self.attempt_id.to_owned()) .and(pa_dsl::merchant_id.eq(self.merchant_id.to_owned())), PaymentAttemptUpdateInternal::from(payment_attempt_update), ) .await .inspect_err(|err| { logger::error!( "Error while updating payment attempt in connector_response flow {:?}", err ); }); let connector_response_result = match generics::generic_update_with_unique_predicate_get_result::< <Self as HasTable>::Table, _, _, _, >( conn, dsl::merchant_id .eq(self.merchant_id.clone()) .and(dsl::payment_id.eq(self.payment_id.clone())) .and(dsl::attempt_id.eq(self.attempt_id.clone())), ConnectorResponseUpdateInternal::from(connector_response), ) .await { Err(error) => match error.current_context() { errors::DatabaseError::NoFieldsToUpdate => Ok(self), _ => Err(error), }, result => result, }; connector_response_result }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 123, "total_crates": null }
fn_clm_diesel_models_find_by_payment_id_merchant_id_attempt_id_-9004894734119123124
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/connector_response // Inherent implementation for ConnectorResponse pub async fn find_by_payment_id_merchant_id_attempt_id( conn: &PgPooledConn, payment_id: &common_utils::id_type::PaymentId, merchant_id: &common_utils::id_type::MerchantId, attempt_id: &str, ) -> StorageResult<Self> { let connector_response: Self = generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id.eq(merchant_id.to_owned()).and( dsl::payment_id .eq(payment_id.to_owned()) .and(dsl::attempt_id.eq(attempt_id.to_owned())), ), ) .await?; match generics::generic_find_one::<<PaymentAttempt as HasTable>::Table, _, _>( conn, pa_dsl::payment_id.eq(payment_id.to_owned()).and( pa_dsl::merchant_id .eq(merchant_id.to_owned()) .and(pa_dsl::attempt_id.eq(attempt_id.to_owned())), ), ) .await { Ok::<PaymentAttempt, _>(payment_attempt) => { if payment_attempt.authentication_data != connector_response.authentication_data { logger::error!( "Not Equal pa_authentication_data : {:?}, cr_authentication_data: {:?} ", payment_attempt.authentication_data, connector_response.authentication_data ); } if payment_attempt.encoded_data != connector_response.encoded_data { logger::error!( "Not Equal pa_encoded_data : {:?}, cr_encoded_data: {:?} ", payment_attempt.encoded_data, connector_response.encoded_data ); } if payment_attempt.connector_transaction_id != connector_response.connector_transaction_id { logger::error!( "Not Equal pa_connector_transaction_id : {:?}, cr_connector_transaction_id: {:?} ", payment_attempt.connector_transaction_id, connector_response.connector_transaction_id ); } if payment_attempt.connector != connector_response.connector_name { logger::error!( "Not Equal pa_connector : {:?}, cr_connector_name: {:?} ", payment_attempt.connector, connector_response.connector_name ); } } Err(err) => { logger::error!( "Error while finding payment attempt in connector_response flow {:?}", err ); } } Ok(connector_response) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 50, "total_crates": null }
fn_clm_diesel_models_insert_6888668563531635163
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/hyperswitch_ai_interaction // Inherent implementation for HyperswitchAiInteractionNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<HyperswitchAiInteraction> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_filter_by_optional_merchant_id_6888668563531635163
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/hyperswitch_ai_interaction // Inherent implementation for HyperswitchAiInteraction pub async fn filter_by_optional_merchant_id( conn: &PgPooledConn, merchant_id: Option<&common_utils::id_type::MerchantId>, limit: i64, offset: i64, ) -> StorageResult<Vec<Self>> { generics::generic_filter::<<Self as HasTable>::Table, _, _, _>( conn, dsl::merchant_id.eq(merchant_id.cloned()), Some(limit), Some(offset), Some(dsl::created_at.desc()), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 24, "total_crates": null }
fn_clm_diesel_models_insert_7678249293171203942
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/payout_attempt // Inherent implementation for PayoutAttemptNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<PayoutAttempt> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_get_filters_for_payouts_7678249293171203942
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/payout_attempt // Inherent implementation for PayoutAttempt pub async fn get_filters_for_payouts( conn: &PgPooledConn, payouts: &[Payouts], merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult<( Vec<String>, Vec<enums::Currency>, Vec<enums::PayoutStatus>, Vec<enums::PayoutType>, )> { let active_attempt_ids = payouts .iter() .map(|payout| { format!( "{}_{}", payout.payout_id.get_string_repr(), payout.attempt_count.clone() ) }) .collect::<Vec<String>>(); let active_payout_ids = payouts .iter() .map(|payout| payout.payout_id.to_owned()) .collect::<Vec<common_utils::id_type::PayoutId>>(); let filter = <Self as HasTable>::table() .filter(dsl::merchant_id.eq(merchant_id.to_owned())) .filter(dsl::payout_attempt_id.eq_any(active_attempt_ids)); let payouts_filter = <Payouts as HasTable>::table() .filter(payout_dsl::merchant_id.eq(merchant_id.to_owned())) .filter(payout_dsl::payout_id.eq_any(active_payout_ids)); let payout_status: Vec<enums::PayoutStatus> = payouts .iter() .map(|payout| payout.status) .collect::<HashSet<enums::PayoutStatus>>() .into_iter() .collect(); let filter_connector = filter .clone() .select(dsl::connector) .distinct() .get_results_async::<Option<String>>(conn) .await .change_context(DatabaseError::Others) .attach_printable("Error filtering records by connector")? .into_iter() .flatten() .collect::<Vec<String>>(); let filter_currency = payouts_filter .clone() .select(payout_dsl::destination_currency) .distinct() .get_results_async::<enums::Currency>(conn) .await .change_context(DatabaseError::Others) .attach_printable("Error filtering records by currency")? .into_iter() .collect::<Vec<enums::Currency>>(); let filter_payout_method = payouts_filter .clone() .select(payout_dsl::payout_type) .distinct() .get_results_async::<Option<enums::PayoutType>>(conn) .await .change_context(DatabaseError::Others) .attach_printable("Error filtering records by payout type")? .into_iter() .flatten() .collect::<Vec<enums::PayoutType>>(); Ok(( filter_connector, filter_currency, payout_status, filter_payout_method, )) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 109, "total_crates": null }
fn_clm_diesel_models_update_with_attempt_id_7678249293171203942
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/payout_attempt // Inherent implementation for PayoutAttempt pub async fn update_with_attempt_id( self, conn: &PgPooledConn, payout_attempt_update: PayoutAttemptUpdate, ) -> StorageResult<Self> { match generics::generic_update_with_unique_predicate_get_result::< <Self as HasTable>::Table, _, _, _, >( conn, dsl::payout_attempt_id .eq(self.payout_attempt_id.to_owned()) .and(dsl::merchant_id.eq(self.merchant_id.to_owned())), PayoutAttemptUpdateInternal::from(payout_attempt_update), ) .await { Err(error) => match error.current_context() { DatabaseError::NoFieldsToUpdate => Ok(self), _ => Err(error), }, result => result, } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 47, "total_crates": null }
fn_clm_diesel_models_update_by_merchant_id_payout_id_7678249293171203942
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/payout_attempt // Inherent implementation for PayoutAttempt pub async fn update_by_merchant_id_payout_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, payout_id: &common_utils::id_type::PayoutId, payout: PayoutAttemptUpdate, ) -> StorageResult<Self> { generics::generic_update_with_results::<<Self as HasTable>::Table, _, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::payout_id.eq(payout_id.to_owned())), PayoutAttemptUpdateInternal::from(payout), ) .await? .first() .cloned() .ok_or_else(|| { report!(DatabaseError::NotFound).attach_printable("Error while updating payout") }) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 38, "total_crates": null }
fn_clm_diesel_models_update_by_merchant_id_payout_attempt_id_7678249293171203942
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/payout_attempt // Inherent implementation for PayoutAttempt pub async fn update_by_merchant_id_payout_attempt_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, payout_attempt_id: &str, payout: PayoutAttemptUpdate, ) -> StorageResult<Self> { generics::generic_update_with_results::<<Self as HasTable>::Table, _, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::payout_attempt_id.eq(payout_attempt_id.to_owned())), PayoutAttemptUpdateInternal::from(payout), ) .await? .first() .cloned() .ok_or_else(|| { report!(DatabaseError::NotFound).attach_printable("Error while updating payout") }) }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 38, "total_crates": null }
fn_clm_diesel_models_insert_-8141976871805289594
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/authentication // Inherent implementation for AuthenticationNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Authentication> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_update_by_merchant_id_authentication_id_-8141976871805289594
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/authentication // Inherent implementation for Authentication pub async fn update_by_merchant_id_authentication_id( conn: &PgPooledConn, merchant_id: common_utils::id_type::MerchantId, authentication_id: common_utils::id_type::AuthenticationId, authorization_update: AuthenticationUpdate, ) -> StorageResult<Self> { match generics::generic_update_with_unique_predicate_get_result::< <Self as HasTable>::Table, _, _, _, >( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::authentication_id.eq(authentication_id.to_owned())), AuthenticationUpdateInternal::from(authorization_update), ) .await { Err(error) => match error.current_context() { errors::DatabaseError::NotFound => Err(error.attach_printable( "Authentication with the given Authentication ID does not exist", )), errors::DatabaseError::NoFieldsToUpdate => { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::authentication_id.eq(authentication_id.to_owned())), ) .await } _ => Err(error), }, result => result, } }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 44, "total_crates": null }
fn_clm_diesel_models_find_authentication_by_merchant_id_connector_authentication_id_-8141976871805289594
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/authentication // Inherent implementation for Authentication pub async fn find_authentication_by_merchant_id_connector_authentication_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, connector_authentication_id: &str, ) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::connector_authentication_id.eq(connector_authentication_id.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 37, "total_crates": null }
fn_clm_diesel_models_find_by_merchant_id_authentication_id_-8141976871805289594
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/authentication // Inherent implementation for Authentication pub async fn find_by_merchant_id_authentication_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, authentication_id: &common_utils::id_type::AuthenticationId, ) -> StorageResult<Self> { generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id .eq(merchant_id.to_owned()) .and(dsl::authentication_id.eq(authentication_id.to_owned())), ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_diesel_models_insert_5045372760619588473
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/merchant_key_store // Inherent implementation for MerchantKeyStoreNew pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<MerchantKeyStore> { generics::generic_insert(conn, self).await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1127, "total_crates": null }
fn_clm_diesel_models_list_all_key_stores_5045372760619588473
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/merchant_key_store // Inherent implementation for MerchantKeyStore pub async fn list_all_key_stores( conn: &PgPooledConn, from: u32, limit: u32, ) -> StorageResult<Vec<Self>> { generics::generic_filter::< <Self as HasTable>::Table, _, <<Self as HasTable>::Table as diesel::Table>::PrimaryKey, _, >( conn, dsl::merchant_id.ne_all(vec!["".to_string()]), Some(limit.into()), Some(from.into()), None, ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 24, "total_crates": null }
fn_clm_diesel_models_list_multiple_key_stores_5045372760619588473
clm
function
// Repository: hyperswitch // Crate: diesel_models // Purpose: Database schema types directly mapping to PostgreSQL tables // Module: crates/diesel_models/src/query/merchant_key_store // Inherent implementation for MerchantKeyStore pub async fn list_multiple_key_stores( conn: &PgPooledConn, merchant_ids: Vec<common_utils::id_type::MerchantId>, ) -> StorageResult<Vec<Self>> { generics::generic_filter::< <Self as HasTable>::Table, _, <<Self as HasTable>::Table as diesel::Table>::PrimaryKey, _, >( conn, dsl::merchant_id.eq_any(merchant_ids), None, None, None, ) .await }
{ "crate": "diesel_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 23, "total_crates": null }