FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mage/cpp/csv_utils_module/algorithm/csv_utils.cpp at main · memgraph/mage · GitHub
This repository was archived by the owner on Jan 23, 2026. It is now read-only.
memgraph
/
mage
Public archive
Notifications
You must be signed in to change notification settings
Fork
35
Star
331
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
mage
/
cpp
/
csv_utils_module
/
algorithm
/
csv_utils.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
44 lines (34 loc) · 1.32 KB
Breadcrumbs
mage
/
cpp
/
csv_utils_module
/
algorithm
/
csv_utils.cpp
Copy path
File metadata and controls
44 lines (34 loc) · 1.32 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#
include
"
csv_utils.hpp
"
namespace
CsvUtils
{
void
CreateCsvFile
(mgp_list *args, mgp_graph *memgraph_graph, mgp_result *result, mgp_memory *memory) {
mgp::MemoryDispatcherGuard
guard
(memory);
const
auto
arguments =
mgp::List
(args);
const
auto
record_factory =
mgp::RecordFactory
(result);
try
{
const
auto
filepath = arguments[
0
].
ValueString
();
const
auto
content = arguments[
1
].
ValueString
();
const
auto
is_append = arguments[
2
].
ValueBool
();
std::ofstream fout;
fout.
open
(
std::string
(filepath), is_append ? std::ofstream::app : std::ofstream::out);
fout << content << std::flush;
fout.
close
();
auto
record = record_factory.
NewRecord
();
record.
Insert
(
std::string
(
kArgumentCreateCsvFile1
).
c_str
(), filepath);
}
catch
(
const
std::exception &e) {
record_factory.
SetErrorMessage
(e.
what
());
}
return
;
}
void
DeleteCsvFile
(mgp_list *args, mgp_graph *memgraph_graph, mgp_result *result, mgp_memory *memory) {
mgp::MemoryDispatcherGuard
guard
(memory);
const
auto
arguments =
mgp::List
(args);
const
auto
record_factory =
mgp::RecordFactory
(result);
try
{
const
std::string_view filepath = arguments[
0
].
ValueString
();
std::remove
(
std::string
(filepath).
c_str
());
}
catch
(
const
std::exception &e) {
record_factory.
SetErrorMessage
(e.
what
());
}
return
;
}
}
//
namespace CsvUtils
Back
|
FazBrowse Home
|
New Git URL