-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
Copy pathio-formats.proto
94 lines (82 loc) · 3.54 KB
/
io-formats.proto
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright 2017 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
syntax = "proto2";
package cockroach.roachpb;
option go_package = "roachpb";
import "gogoproto/gogo.proto";
message IOFileFormat {
enum FileFormat {
Unknown = 0;
CSV = 1;
MysqlOutfile = 2;
Mysqldump = 3;
PgCopy = 4;
PgDump = 5;
}
optional FileFormat format = 1 [(gogoproto.nullable) = false];
optional CSVOptions csv = 2 [(gogoproto.nullable) = false];
optional MySQLOutfileOptions mysql_out = 3 [(gogoproto.nullable) = false];
optional PgCopyOptions pg_copy = 4 [(gogoproto.nullable) = false];
optional PgDumpOptions pg_dump = 6 [(gogoproto.nullable) = false];
enum Compression {
Auto = 0;
None = 1;
Gzip = 2;
Bzip = 3;
}
optional Compression compression = 5 [(gogoproto.nullable) = false];
}
// CSVOptions describe the format of csv data (delimiter, comment, etc).
message CSVOptions {
// comma is an delimiter used by the CSV file; defaults to a comma.
optional int32 comma = 1 [(gogoproto.nullable) = false];
// comment is an comment rune; zero value means comments not enabled.
optional int32 comment = 2 [(gogoproto.nullable) = false];
// null_encoding, if not nil, is the string which identifies a NULL. Can be the empty string.
optional string null_encoding = 3 [(gogoproto.nullable) = true];
// skip the first N lines of the input (e.g. to ignore column headers) when reading.
optional uint32 skip = 4 [(gogoproto.nullable) = false];
}
// MySQLOutfileOptions describe the format of mysql's outfile.
message MySQLOutfileOptions {
enum Enclose {
Never = 0;
Always = 1;
Optional = 2;
}
// row_separator is the delimiter between rows (mysql's --rows-terminated-by)
optional int32 row_separator = 1 [(gogoproto.nullable) = false];
// field_separator is the delimiter between fields (mysql's --fields-terminated-by)
optional int32 field_separator = 2 [(gogoproto.nullable) = false];
// enclose is the enclosing (quoting) behavior (i.e. if specified and if optional).
optional Enclose enclose = 3 [(gogoproto.nullable) = false];
// encloser is the character used to enclose (qupte) fields (--fields-enclosed-by)
optional int32 encloser = 4 [(gogoproto.nullable) = false];
// has_escape indicates that an escape character is set (mysql's default is not).
optional bool has_escape = 5 [(gogoproto.nullable) = false];
// escape is the character used to prefix the other delimiters (--fields-escaped-by)
optional int32 escape = 6 [(gogoproto.nullable) = false];
// If true, don't abort on failures but instead save the offending row and keep on.
optional bool save_rejected = 7 [(gogoproto.nullable) = false];
}
// PgCopyOptions describe the format of postgresql's COPY TO STDOUT.
message PgCopyOptions {
// delimiter is the delimitor between columns (DELIMITER)
optional int32 delimiter = 1 [(gogoproto.nullable) = false];
// null is the NULL value (NULL)
optional string null = 2 [(gogoproto.nullable) = false];
// maxRowSize is the maximum row size
optional int32 maxRowSize = 3 [(gogoproto.nullable) = false];
}
// PgDumpOptions describe the format of postgresql's pg_dump.
message PgDumpOptions {
// maxRowSize is the maximum row size
optional int32 maxRowSize = 1 [(gogoproto.nullable) = false];
}