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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//! Core types and data structures for the virtual table
//!
//! This module defines the fundamental types used throughout the library:
//! - `FileMetadata`: Represents a file or directory in cloud storage
//! - `QueryConfig`: Configuration for how queries should be executed
use ;
/// Represents metadata for a file or directory in cloud storage
///
/// This struct contains all the information that can be queried through
/// the virtual table SQL interface. It's designed to be lightweight by default,
/// only fetching file contents when explicitly requested.
///
/// # Examples
///
/// ```
/// use sqlite_vtable_opendal::types::FileMetadata;
///
/// let file = FileMetadata {
/// name: "document.pdf".to_string(),
/// path: "/docs/document.pdf".to_string(),
/// size: 1024000,
/// last_modified: Some("2024-01-15T10:30:00Z".to_string()),
/// etag: Some("abc123".to_string()),
/// is_dir: false,
/// content_type: Some("application/pdf".to_string()),
/// content: None, // Not fetched by default
/// };
/// ```
/// Configuration for querying file metadata
///
/// This struct controls how the virtual table fetches data from cloud storage.
/// Users can configure whether to fetch content, recurse into directories,
/// and implement pagination.
///
/// # Examples
///
/// ```
/// use sqlite_vtable_opendal::types::QueryConfig;
///
/// // Metadata-only query (default)
/// let config = QueryConfig::default();
///
/// // Fetch file contents as well
/// let config = QueryConfig {
/// fetch_content: true,
/// ..Default::default()
/// };
///
/// // Recursive listing with pagination
/// let config = QueryConfig {
/// root_path: "/documents".to_string(),
/// recursive: true,
/// limit: Some(100),
/// offset: 0,
/// ..Default::default()
/// };
/// ```
/// Column indices for the virtual table schema
///
/// These constants make it easier to reference columns by name
/// rather than magic numbers in the code.