Loading...
Searching...
No Matches
as_exp_operations.h
Go to the documentation of this file.
1/*
2 * Copyright 2008-2022 Aerospike, Inc.
3 *
4 * Portions may be licensed to Aerospike, Inc. under one or more contributor
5 * license agreements.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
8 * use this file except in compliance with the License. You may obtain a copy of
9 * the License at http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17#pragma once
18
19/**
20 * @defgroup exp_operations Expression Operations
21 * @ingroup client_operations
22 *
23 * Expression operations.
24 */
25
27#include <aerospike/as_exp.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/******************************************************************************
34 * TYPES
35 *****************************************************************************/
36
37/**
38 * Expression write flags.
39 *
40 * @ingroup exp_operations
41 */
42typedef enum as_exp_write_flags_e {
43 /**
44 * Default. Allow create or update.
45 */
47
48 /**
49 * If bin does not exist, a new bin will be created.
50 * If bin exists, the operation will be denied.
51 * If bin exists, fail with AEROSPIKE_ERR_BIN_EXISTS
52 * when AS_EXP_WRITE_POLICY_NO_FAIL is not set.
53 */
55
56 /**
57 * If bin exists, the bin will be overwritten.
58 * If bin does not exist, the operation will be denied.
59 * If bin does not exist, fail with AEROSPIKE_ERR_BIN_NOT_FOUND
60 * when AS_EXP_WRITE_POLICY_NO_FAIL is not set.
61 */
63
64 /**
65 * If expression results in nil value, then delete the bin. Otherwise, return
66 * AEROSPIKE_ERR_OP_NOT_APPLICABLE when AS_EXP_WRITE_POLICY_NO_FAIL is not set.
67 */
69
70 /**
71 * Do not raise error if operation is denied.
72 */
74
75 /**
76 * Ignore failures caused by the expression resolving to unknown or a non-bin type.
77 */
80
81/**
82 * Expression read flags.
83 *
84 * @ingroup exp_operations
85 */
86typedef enum as_exp_read_flags_e {
87 /**
88 * Default.
89 */
91
92 /**
93 * Ignore failures caused by the expression resolving to unknown or a non-bin type.
94 */
97
98/******************************************************************************
99 * PUBLIC FUNCTIONS
100 *****************************************************************************/
101
102/**
103 * Create operation that performs an expression that writes to a record bin.
104 * Requires server version 5.6.0+.
105 *
106 * @param ops Operations array.
107 * @param name Name of bin.
108 * @param exp Expression to evaluate.
109 * @param flags Expression write flags. Multiple flags can be specified via "|" operator.
110 * @ingroup exp_operations
111 */
112AS_EXTERN bool
114 as_operations* ops, const char* name, const as_exp* exp, as_exp_write_flags flags
115 );
116
117/**
118 * Create operation that performs a read expression.
119 * Requires server version 5.6.0+.
120 *
121 * @param ops Operations array.
122 * @param name Variable name of read expression result. This name can be used as the
123 * bin name when retrieving bin results from the record.
124 * @param exp Expression to evaluate.
125 * @param flags Expression read flags.
126 * @ingroup exp_operations
127 */
128AS_EXTERN bool
130 as_operations* ops, const char* name, const as_exp* exp, as_exp_read_flags flags
131 );
132
133#ifdef __cplusplus
134} // end extern "C"
135#endif
#define AS_EXTERN
Definition as_std.h:25
as_exp_write_flags
as_exp_read_flags
AS_EXTERN bool as_operations_exp_write(as_operations *ops, const char *name, const as_exp *exp, as_exp_write_flags flags)
AS_EXTERN bool as_operations_exp_read(as_operations *ops, const char *name, const as_exp *exp, as_exp_read_flags flags)
@ AS_EXP_WRITE_DEFAULT
@ AS_EXP_WRITE_ALLOW_DELETE
@ AS_EXP_WRITE_UPDATE_ONLY
@ AS_EXP_WRITE_EVAL_NO_FAIL
@ AS_EXP_WRITE_CREATE_ONLY
@ AS_EXP_WRITE_POLICY_NO_FAIL
@ AS_EXP_READ_DEFAULT
@ AS_EXP_READ_EVAL_NO_FAIL