LCOV - code coverage report
Current view: top level - src/include/utils - cash.h (source / functions) Hit Total Coverage
Test: PostgreSQL 18devel Lines: 4 4 100.0 %
Date: 2024-11-21 08:14:44 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * src/include/utils/cash.h
       3             :  *
       4             :  *
       5             :  * cash.h
       6             :  * Written by D'Arcy J.M. Cain
       7             :  *
       8             :  * Functions to allow input and output of money normally but store
       9             :  *  and handle it as 64 bit integer.
      10             :  */
      11             : 
      12             : #ifndef CASH_H
      13             : #define CASH_H
      14             : 
      15             : #include "fmgr.h"
      16             : 
      17             : typedef int64 Cash;
      18             : 
      19             : /* Cash is pass-by-reference if and only if int64 is */
      20             : static inline Cash
      21       21042 : DatumGetCash(Datum X)
      22             : {
      23       21042 :     return DatumGetInt64(X);
      24             : }
      25             : 
      26             : static inline Datum
      27        3176 : CashGetDatum(Cash X)
      28             : {
      29        3176 :     return Int64GetDatum(X);
      30             : }
      31             : 
      32             : #define PG_GETARG_CASH(n)   DatumGetCash(PG_GETARG_DATUM(n))
      33             : #define PG_RETURN_CASH(x)   return CashGetDatum(x)
      34             : 
      35             : #endif                          /* CASH_H */

Generated by: LCOV version 1.14