Skip to content

Commit ba9e0e8

Browse files
authored
Add format for tools (#3244)
* Add format for tools * Run clang-format --------- Co-authored-by: CI Bot <mewim@users.noreply.github.com>
1 parent b388c1e commit ba9e0e8

7 files changed

Lines changed: 32 additions & 20 deletions

File tree

src_cpp/include/node_connection.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ class ConnectionInitAsyncWorker : public Napi::AsyncWorker {
4343
inline void Execute() override {
4444
try {
4545
nodeConnection->InitCppConnection();
46-
} catch (const std::exception& exc) { SetError(std::string(exc.what())); }
46+
} catch (const std::exception& exc) {
47+
SetError(std::string(exc.what()));
48+
}
4749
}
4850

4951
inline void OnOK() override { Callback().Call({Env().Null()}); }
@@ -80,7 +82,9 @@ class ConnectionExecuteAsyncWorker : public Napi::AsyncWorker {
8082
SetError(result->getErrorMessage());
8183
return;
8284
}
83-
} catch (const std::exception& exc) { SetError(std::string(exc.what())); }
85+
} catch (const std::exception& exc) {
86+
SetError(std::string(exc.what()));
87+
}
8488
}
8589

8690
inline void OnOK() override { Callback().Call({Env().Null()}); }

src_cpp/include/node_database.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ class DatabaseInitAsyncWorker : public Napi::AsyncWorker {
4343
try {
4444
nodeDatabase->InitCppDatabase();
4545

46-
} catch (const std::exception& exc) { SetError(std::string(exc.what())); }
46+
} catch (const std::exception& exc) {
47+
SetError(std::string(exc.what()));
48+
}
4749
}
4850

4951
inline void OnOK() override { Callback().Call({Env().Null()}); }

src_cpp/include/node_prepared_statement.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@ class NodePreparedStatement : public Napi::ObjectWrap<NodePreparedStatement> {
2929

3030
class PreparedStatementInitAsyncWorker : public Napi::AsyncWorker {
3131
public:
32-
PreparedStatementInitAsyncWorker(
33-
Napi::Function& callback, NodePreparedStatement* nodePreparedStatement)
32+
PreparedStatementInitAsyncWorker(Napi::Function& callback,
33+
NodePreparedStatement* nodePreparedStatement)
3434
: AsyncWorker(callback), nodePreparedStatement(nodePreparedStatement) {}
3535

3636
~PreparedStatementInitAsyncWorker() override = default;
3737

3838
inline void Execute() override {
3939
try {
4040
nodePreparedStatement->InitCppPreparedStatement();
41-
} catch (const std::exception& exc) { SetError(std::string(exc.what())); }
41+
} catch (const std::exception& exc) {
42+
SetError(std::string(exc.what()));
43+
}
4244
}
4345

4446
inline void OnOK() override { Callback().Call({Env().Null()}); }

src_cpp/include/node_query_result.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ enum GetColumnMetadataType { DATA_TYPE, NAME };
3636

3737
class NodeQueryResultGetColumnMetadataAsyncWorker : public Napi::AsyncWorker {
3838
public:
39-
NodeQueryResultGetColumnMetadataAsyncWorker(
40-
Napi::Function& callback, NodeQueryResult* nodeQueryResult, GetColumnMetadataType type)
39+
NodeQueryResultGetColumnMetadataAsyncWorker(Napi::Function& callback,
40+
NodeQueryResult* nodeQueryResult, GetColumnMetadataType type)
4141
: AsyncWorker(callback), nodeQueryResult(nodeQueryResult), type(type) {}
4242

4343
~NodeQueryResultGetColumnMetadataAsyncWorker() override = default;
@@ -53,7 +53,9 @@ class NodeQueryResultGetColumnMetadataAsyncWorker : public Napi::AsyncWorker {
5353
} else {
5454
result = nodeQueryResult->queryResult->getColumnNames();
5555
}
56-
} catch (const std::exception& exc) { SetError(std::string(exc.what())); }
56+
} catch (const std::exception& exc) {
57+
SetError(std::string(exc.what()));
58+
}
5759
}
5860

5961
inline void OnOK() override {
@@ -86,7 +88,9 @@ class NodeQueryResultGetNextAsyncWorker : public Napi::AsyncWorker {
8688
cppTuple.reset();
8789
}
8890
cppTuple = nodeQueryResult->queryResult->getNext();
89-
} catch (const std::exception& exc) { SetError(std::string(exc.what())); }
91+
} catch (const std::exception& exc) {
92+
SetError(std::string(exc.what()));
93+
}
9094
}
9195

9296
inline void OnOK() override {

src_cpp/include/node_util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ class Util {
1414

1515
private:
1616
static Napi::Object ConvertNodeIdToNapiObject(const nodeID_t& nodeId, Napi::Env env);
17-
static Value TransformNapiValue(
18-
Napi::Value napiValue, LogicalType* expectedDataType, const std::string& key);
17+
static Value TransformNapiValue(Napi::Value napiValue, LogicalType* expectedDataType,
18+
const std::string& key);
1919
};

src_cpp/node_query_result.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ Napi::Value NodeQueryResult::GetColumnDataTypesAsync(const Napi::CallbackInfo& i
7676
Napi::Env env = info.Env();
7777
Napi::HandleScope scope(env);
7878
auto callback = info[0].As<Napi::Function>();
79-
auto* asyncWorker = new NodeQueryResultGetColumnMetadataAsyncWorker(
80-
callback, this, GetColumnMetadataType::DATA_TYPE);
79+
auto* asyncWorker = new NodeQueryResultGetColumnMetadataAsyncWorker(callback, this,
80+
GetColumnMetadataType::DATA_TYPE);
8181
asyncWorker->Queue();
8282
return info.Env().Undefined();
8383
}
@@ -86,8 +86,8 @@ Napi::Value NodeQueryResult::GetColumnNamesAsync(const Napi::CallbackInfo& info)
8686
Napi::Env env = info.Env();
8787
Napi::HandleScope scope(env);
8888
auto callback = info[0].As<Napi::Function>();
89-
auto* asyncWorker = new NodeQueryResultGetColumnMetadataAsyncWorker(
90-
callback, this, GetColumnMetadataType::NAME);
89+
auto* asyncWorker = new NodeQueryResultGetColumnMetadataAsyncWorker(callback, this,
90+
GetColumnMetadataType::NAME);
9191
asyncWorker->Queue();
9292
return info.Env().Undefined();
9393
}

src_cpp/node_util.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ Napi::Object Util::ConvertNodeIdToNapiObject(const nodeID_t& nodeId, Napi::Env e
303303
return napiObject;
304304
}
305305

306-
Value Util::TransformNapiValue(
307-
Napi::Value napiValue, LogicalType* expectedDataType, const std::string& key) {
306+
Value Util::TransformNapiValue(Napi::Value napiValue, LogicalType* expectedDataType,
307+
const std::string& key) {
308308
auto logicalTypeId = expectedDataType->getLogicalTypeID();
309309
switch (logicalTypeId) {
310310
case LogicalTypeID::BOOL: {
@@ -461,8 +461,8 @@ Value Util::TransformNapiValue(
461461
auto microseconds = napiInterval * Interval::MICROS_PER_MSEC;
462462
auto intervalVal = interval_t(0, 0, microseconds);
463463
int64_t normalizedMonths, normalizedDays, normalizedMicros;
464-
Interval::normalizeIntervalEntries(
465-
intervalVal, normalizedMonths, normalizedDays, normalizedMicros);
464+
Interval::normalizeIntervalEntries(intervalVal, normalizedMonths, normalizedDays,
465+
normalizedMicros);
466466
auto normalizedInterval = interval_t(normalizedMonths, normalizedDays, normalizedMicros);
467467
return Value(normalizedInterval);
468468
}

0 commit comments

Comments
 (0)