Code

postrr.h: Updated prototype for rrtimeslice_to_timestamptz().
[postrr.git] / src / postrr.h.in
1 /*
2  * PostRR - src/postrr.h
3  * Copyright (C) 2012 Sebastian 'tokkee' Harl <sh@tokkee.org>
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
19  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
28 /*
29  * PostgreSQL Round-Robin Extension
30  */
32 #ifndef POSTRR_H
33 #define POSTRR_H 1
35 #include <postgres.h>
36 #include <fmgr.h>
38 #define POSTRR_VERSION_MAJOR @POSTRR_VERSION_MAJOR@
39 #define POSTRR_VERSION_MINOR @POSTRR_VERSION_MINOR@
40 #define POSTRR_VERSION_PATCH @POSTRR_VERSION_PATCH@
42 #define POSTRR_VERSION_EXTRA "@POSTRR_VERSION_EXTRA@"
44 #define POSTRR_VERSION_STRING "@POSTRR_VERSION_STRING@"
46 #define POSTRR_VERSION_ENCODE(major, minor, patch) \
47         ((major) * 10000 + (minor) * 100 + (patch))
49 #define POSTRR_VERSION POSTRR_VERSION_ENCODE(POSTRR_VERSION_MAJOR, \
50                 POSTRR_VERSION_MINOR, POSTRR_VERSION_PATCH)
52 Datum
53 postrr_version(PG_FUNCTION_ARGS);
55 /*
56  * RRTimeslice data type
57  */
59 struct rrtimeslice;
60 typedef struct rrtimeslice rrtimeslice_t;
62 #define PG_GETARG_RRTIMESLICE_P(n) (rrtimeslice_t *)PG_GETARG_POINTER(n)
63 #define PG_RETURN_RRTIMESLICE_P(p) PG_RETURN_POINTER(p)
65 Datum
66 rrtimeslice_validate(PG_FUNCTION_ARGS);
68 /* I/O functions */
69 Datum
70 rrtimeslice_in(PG_FUNCTION_ARGS);
71 Datum
72 rrtimeslice_out(PG_FUNCTION_ARGS);
73 Datum
74 rrtimeslice_typmodin(PG_FUNCTION_ARGS);
75 Datum
76 rrtimeslice_typmodout(PG_FUNCTION_ARGS);
78 /* casts */
79 Datum
80 rrtimeslice_to_rrtimeslice(PG_FUNCTION_ARGS);
81 Datum
82 rrtimeslice_to_timestamptz(PG_FUNCTION_ARGS);
84 /* comparison operators */
85 Datum
86 rrtimeslice_seq_eq(PG_FUNCTION_ARGS);
87 Datum
88 rrtimeslice_seq_ne(PG_FUNCTION_ARGS);
89 Datum
90 rrtimeslice_seq_lt(PG_FUNCTION_ARGS);
91 Datum
92 rrtimeslice_seq_le(PG_FUNCTION_ARGS);
93 Datum
94 rrtimeslice_seq_gt(PG_FUNCTION_ARGS);
95 Datum
96 rrtimeslice_seq_ge(PG_FUNCTION_ARGS);
97 Datum
98 rrtimeslice_seq_cmp(PG_FUNCTION_ARGS);
99 Datum
100 rrtimeslice_seq_hash(PG_FUNCTION_ARGS);
102 /*
103  * internal (not fmgr-callable) functions
104  */
106 int
107 rrtimeslice_seq_cmp_internal(rrtimeslice_t *ts1, rrtimeslice_t *ts2);
109 /*
110  * CData data type
111  */
113 struct cdata;
114 typedef struct cdata cdata_t;
116 #define PG_GETARG_CDATA_P(n) (cdata_t *)PG_GETARG_POINTER(n)
117 #define PG_RETURN_CDATA_P(p) PG_RETURN_POINTER(p)
119 Datum
120 cdata_validate(PG_FUNCTION_ARGS);
122 /* I/O functions */
123 Datum
124 cdata_in(PG_FUNCTION_ARGS);
125 Datum
126 cdata_out(PG_FUNCTION_ARGS);
127 Datum
128 cdata_typmodin(PG_FUNCTION_ARGS);
129 Datum
130 cdata_typmodout(PG_FUNCTION_ARGS);
132 /* casts */
133 Datum
134 cdata_to_cdata(PG_FUNCTION_ARGS);
135 Datum
136 int32_to_cdata(PG_FUNCTION_ARGS);
137 Datum
138 cdata_to_float8(PG_FUNCTION_ARGS);
140 /* aux. functions */
141 Datum
142 cdata_update(PG_FUNCTION_ARGS);
144 #endif /* ! POSTRR_H */
146 /* vim: set tw=78 sw=4 ts=4 noexpandtab : */