[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] branch master updated: [db] added get donation units
From: |
gnunet |
Subject: |
[taler-donau] branch master updated: [db] added get donation units |
Date: |
Fri, 12 Jan 2024 15:46:28 +0100 |
This is an automated email from the git hooks/post-receive script.
johannes-casaburi pushed a commit to branch master
in repository donau.
The following commit(s) were added to refs/heads/master by this push:
new cba6104 [db] added get donation units
cba6104 is described below
commit cba61048b6ce3614fb48c2d7b1870a1170827bed
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Fri Jan 12 15:45:22 2024 +0100
[db] added get donation units
---
contrib/gana | 2 +-
src/donaudb/Makefile.am | 1 +
src/donaudb/pg_get_donation_units.c | 55 +++++++++++++++++++++++++++++++++++++
src/donaudb/pg_get_donation_units.h | 39 ++++++++++++++++++++++++++
src/include/donaudb_plugin.h | 26 +++++++++++++++++-
5 files changed, 121 insertions(+), 2 deletions(-)
diff --git a/contrib/gana b/contrib/gana
index 8368009..40f6cf1 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 836800945d80db9c0160a10a84edc1a086339187
+Subproject commit 40f6cf1015231663064eda98aa1e403cddd7b970
diff --git a/src/donaudb/Makefile.am b/src/donaudb/Makefile.am
index 372ffa5..099e5e6 100644
--- a/src/donaudb/Makefile.am
+++ b/src/donaudb/Makefile.am
@@ -83,6 +83,7 @@ libtaler_plugin_donaudb_postgres_la_SOURCES = \
pg_lookup_signing_key.h pg_lookup_signing_key.c \
pg_add_donation_unit_key.c pg_add_donation_unit_key.h \
pg_lookup_donation_unit.c pg_lookup_donation_unit.h \
+ pg_get_donation_units.c pg_get_donation_units.h \
pg_get_charities.h pg_get_charities.c \
pg_insert_charity.h pg_insert_charity.c \
pg_lookup_charity.h pg_lookup_charity.c \
diff --git a/src/donaudb/pg_get_donation_units.c
b/src/donaudb/pg_get_donation_units.c
new file mode 100644
index 0000000..d288e07
--- /dev/null
+++ b/src/donaudb/pg_get_donation_units.c
@@ -0,0 +1,55 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2023 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+/**
+ * @file donaudb/pg_get_donation_units.c
+ * @brief Implementation of the get_donation_units function for Postgres
+ * @author Johannes Casaburi
+ */
+#include "taler/platform.h"
+#include "taler/taler_error_codes.h"
+#include "taler/taler_dbevents.h"
+#include "taler/taler_pq_lib.h"
+#include "pg_get_donation_units.h"
+#include "pg_helper.h"
+
+enum GNUNET_DB_QueryStatus
+DH_PG_get_donation_units (
+ void *cls,
+ struct DONAUDB_DonationUnitKeyMetaData *meta)
+{
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_end
+ };
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ GNUNET_PQ_result_spec_uint64 ("validity_year",
+ &meta->validity_year),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
+ &meta->value),
+ GNUNET_PQ_result_spec_end
+ };
+
+ PREPARE (pg,
+ "get_donation_units",
+ "SELECT"
+ " validity_year"
+ ",amount"
+ " FROM donation_units");
+ return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+ "get_donation_units",
+ params,
+ rs);
+}
diff --git a/src/donaudb/pg_get_donation_units.h
b/src/donaudb/pg_get_donation_units.h
new file mode 100644
index 0000000..2f209df
--- /dev/null
+++ b/src/donaudb/pg_get_donation_units.h
@@ -0,0 +1,39 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2023 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+/**
+ * @file donaudb/pg_get_donation_units.h
+ * @brief implementation of the get_donation_units function for Postgres
+ * @author Johannes Casaburi
+ */
+#ifndef PG_LOOKUP_DONATION_UNIT_KEY_H
+#define PG_LOOKUP_DONATION_UNIT_KEY_H
+
+#include <taler/taler_util.h>
+#include "taler/taler_json_lib.h"
+#include "donaudb_plugin.h"
+/**
+ * Lookup information about current donation unit key.
+ *
+ * @param cls closure
+ * @param[out] meta set to various meta data about the key
+ * @return transaction status code
+ */
+enum GNUNET_DB_QueryStatus
+DH_PG_get_donation_units (
+ void *cls,
+ struct DONAUDB_DonationUnitKeyMetaData *meta);
+
+#endif
diff --git a/src/include/donaudb_plugin.h b/src/include/donaudb_plugin.h
index ac10f55..7756369 100644
--- a/src/include/donaudb_plugin.h
+++ b/src/include/donaudb_plugin.h
@@ -135,11 +135,22 @@ struct DONAUDB_DonationUnitKey
* @param info donation unit key information
*/
typedef void
-(*DONAUDB_DonationUnitsCallback)(
+(*DONAUDB_DonationUnitCallback)(
void *cls,
const struct DONAU_DonationUnitPublicKey *donation_unit_pub,
struct DONAUDB_DonationUnitKeyMetaData *info);
+/**
+ * Signature of a function called with information about the donau's
+ * donation unit keys.
+ *
+ * @param cls closure with a `struct DH_KeyStateHandle *`
+ * @param info donation unit key information
+ */
+typedef void
+(*DONAUDB_GetDonationUnitsCallback)(
+ void *cls,
+ struct DONAUDB_DonationUnitKeyMetaData *info);
/**
* Signature of a function called with information about the donau's
@@ -386,6 +397,19 @@ struct DONAUDB_Plugin
struct TALER_Amount *receipts_to_date,
uint64_t current_year);
+ /**
+ * Get keys.
+ *
+ * @param cls closure
+ * @param cb callback to invoke on each match
+ * @param cb_cls closure for @a cb
+ * @return database transaction status
+ */
+ enum GNUNET_DB_QueryStatus
+ (*get_keys)(
+ void *cls,
+ DONAUDB_GetDonationUnitsCallback cb,
+ void *cb_cls);
};
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-donau] branch master updated: [db] added get donation units,
gnunet <=