duckdb 0.4.1-dev17.0 → 0.4.1-dev182.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,17 @@
1
1
  #pragma once
2
2
  #define NODE_ADDON_API_DISABLE_DEPRECATED
3
+ #include "duckdb.hpp"
4
+
3
5
  #include <napi.h>
4
6
  #include <queue>
5
7
  #include <unordered_map>
6
8
 
7
- #include "duckdb.hpp"
8
-
9
9
  namespace node_duckdb {
10
10
 
11
11
  struct Task {
12
- Task(Napi::Reference<Napi::Object> &object_, Napi::Function cb_) : object(object_) {
13
- if (!cb_.IsUndefined() && cb_.IsFunction()) {
14
- callback = Persistent(cb_); // TODO not sure what this does
12
+ Task(Napi::Reference<Napi::Object> &object, Napi::Function cb) : object(object) {
13
+ if (!cb.IsUndefined() && cb.IsFunction()) {
14
+ callback = Persistent(cb); // TODO not sure what this does
15
15
  }
16
16
  object.Ref();
17
17
  }
@@ -40,7 +40,7 @@ class Connection;
40
40
 
41
41
  class Database : public Napi::ObjectWrap<Database> {
42
42
  public:
43
- Database(const Napi::CallbackInfo &info);
43
+ explicit Database(const Napi::CallbackInfo &info);
44
44
  static Napi::Object Init(Napi::Env env, Napi::Object exports);
45
45
  void Process(Napi::Env env);
46
46
  void TaskComplete(Napi::Env env);
@@ -50,8 +50,9 @@ public:
50
50
  static bool HasInstance(Napi::Value val) {
51
51
  Napi::Env env = val.Env();
52
52
  Napi::HandleScope scope(env);
53
- if (!val.IsObject())
53
+ if (!val.IsObject()) {
54
54
  return false;
55
+ }
55
56
  Napi::Object obj = val.As<Napi::Object>();
56
57
  return obj.InstanceOf(constructor.Value());
57
58
  }
@@ -78,14 +79,14 @@ private:
78
79
  };
79
80
 
80
81
  struct JSArgs;
81
- void DuckDBNodeUDFLauncher(Napi::Env env, Napi::Function jsudf, nullptr_t *, JSArgs *data);
82
+ void DuckDBNodeUDFLauncher(Napi::Env env, Napi::Function jsudf, std::nullptr_t *, JSArgs *data);
82
83
 
83
- typedef Napi::TypedThreadSafeFunction<nullptr_t, JSArgs, DuckDBNodeUDFLauncher> DuckDBNodeUDFFUnction;
84
+ typedef Napi::TypedThreadSafeFunction<std::nullptr_t, JSArgs, DuckDBNodeUDFLauncher> duckdb_node_udf_function_t;
84
85
 
85
86
  class Connection : public Napi::ObjectWrap<Connection> {
86
87
  public:
87
- Connection(const Napi::CallbackInfo &info);
88
- ~Connection();
88
+ explicit Connection(const Napi::CallbackInfo &info);
89
+ ~Connection() override;
89
90
  static Napi::Object Init(Napi::Env env, Napi::Object exports);
90
91
 
91
92
  public:
@@ -97,8 +98,9 @@ public:
97
98
  static bool HasInstance(Napi::Value val) {
98
99
  Napi::Env env = val.Env();
99
100
  Napi::HandleScope scope(env);
100
- if (!val.IsObject())
101
+ if (!val.IsObject()) {
101
102
  return false;
103
+ }
102
104
  Napi::Object obj = val.As<Napi::Object>();
103
105
  return obj.InstanceOf(constructor.Value());
104
106
  }
@@ -107,15 +109,15 @@ public:
107
109
  static Napi::FunctionReference constructor;
108
110
  std::unique_ptr<duckdb::Connection> connection;
109
111
  Database *database_ref;
110
- std::unordered_map<std::string, DuckDBNodeUDFFUnction> udfs;
112
+ std::unordered_map<std::string, duckdb_node_udf_function_t> udfs;
111
113
  };
112
114
 
113
115
  struct StatementParam;
114
116
 
115
117
  class Statement : public Napi::ObjectWrap<Statement> {
116
118
  public:
117
- Statement(const Napi::CallbackInfo &info);
118
- ~Statement();
119
+ explicit Statement(const Napi::CallbackInfo &info);
120
+ ~Statement() override;
119
121
  static Napi::Object Init(Napi::Env env, Napi::Object exports);
120
122
  void SetProcessFirstParam() {
121
123
  ignore_first_param = false;
@@ -126,8 +128,7 @@ public:
126
128
  Napi::Value Each(const Napi::CallbackInfo &info);
127
129
  Napi::Value Run(const Napi::CallbackInfo &info);
128
130
  Napi::Value Bind(const Napi::CallbackInfo &info);
129
-
130
- Napi::Value Finalize_(const Napi::CallbackInfo &info);
131
+ Napi::Value Finish(const Napi::CallbackInfo &info);
131
132
 
132
133
  public:
133
134
  static Napi::FunctionReference constructor;
@@ -158,4 +159,6 @@ public:
158
159
  }
159
160
  };
160
161
 
162
+ Napi::Array EncodeDataChunk(Napi::Env env, duckdb::DataChunk &chunk, bool with_types, bool with_data);
163
+
161
164
  } // namespace node_duckdb