pub use super::alter_ops::{AlterCollectionOp, AlterRoleOp, AlterUserOp};
pub use super::graph_types::{GraphDirection, GraphProperties};
pub use nodedb_types::{AuditDmlMode, QuotaSpec};
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum CloneAsOf {
Latest,
SystemTimeMs(i64),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum AlterDatabaseOperation {
Rename { new_name: String },
SetQuota(QuotaSpec),
SetDefault,
Materialize,
Promote,
SetAuditDml(AuditDmlMode),
SetIdleTimeout(u64),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum AlterTenantOperation {
SetQuota(QuotaSpec),
}
#[derive(Debug, Clone, PartialEq)]
pub enum NodedbStatement {
CreateCollection {
name: String,
if_not_exists: bool,
engine: Option<String>,
columns: Vec<(String, String)>,
options: Vec<(String, String)>,
flags: Vec<String>,
balanced_raw: Option<String>,
},
CreateTable {
name: String,
if_not_exists: bool,
engine: Option<String>,
columns: Vec<(String, String)>,
options: Vec<(String, String)>,
flags: Vec<String>,
balanced_raw: Option<String>,
},
DropCollection {
name: String,
if_exists: bool,
purge: bool,
cascade: bool,
cascade_force: bool,
},
UndropCollection {
name: String,
},
AlterCollection {
name: String,
operation: AlterCollectionOp,
},
DescribeCollection {
name: String,
},
ShowCollections,
CreateIndex {
unique: bool,
index_name: Option<String>,
collection: String,
field: String,
case_insensitive: bool,
where_condition: Option<String>,
},
DropIndex {
name: String,
collection: Option<String>,
if_exists: bool,
},
ShowIndexes {
collection: Option<String>,
},
Reindex {
collection: String,
index_name: Option<String>,
concurrent: bool,
},
CreateTrigger {
or_replace: bool,
execution_mode: String,
name: String,
timing: String,
events_insert: bool,
events_update: bool,
events_delete: bool,
collection: String,
granularity: String,
when_condition: Option<String>,
priority: i32,
security: String,
body_sql: String,
},
DropTrigger {
name: String,
collection: String,
if_exists: bool,
},
AlterTrigger {
name: String,
action: String,
new_owner: Option<String>,
},
ShowTriggers {
collection: Option<String>,
},
CreateSchedule {
name: String,
cron_expr: String,
body_sql: String,
scope: String,
missed_policy: String,
allow_overlap: bool,
},
DropSchedule {
name: String,
if_exists: bool,
},
AlterSchedule {
name: String,
action: String,
cron_expr: Option<String>,
},
ShowSchedules,
ShowScheduleHistory {
name: String,
},
CreateSequence {
name: String,
if_not_exists: bool,
start: Option<i64>,
increment: Option<i64>,
min_value: Option<i64>,
max_value: Option<i64>,
cycle: bool,
cache: Option<i64>,
format_template_raw: Option<String>,
reset_period_raw: Option<String>,
gap_free: bool,
scope: Option<String>,
},
DropSequence {
name: String,
if_exists: bool,
},
AlterSequence {
name: String,
action: String,
with_value: Option<String>,
},
DescribeSequence {
name: String,
},
ShowSequences,
CreateAlert {
name: String,
collection: String,
where_filter: Option<String>,
condition_raw: String,
group_by: Vec<String>,
window_raw: String,
fire_after: u32,
recover_after: u32,
severity: String,
notify_targets_raw: String,
},
DropAlert {
name: String,
if_exists: bool,
},
AlterAlert {
name: String,
action: String,
},
ShowAlerts,
ShowAlertStatus {
name: String,
},
CreateRetentionPolicy {
name: String,
collection: String,
body_raw: String,
eval_interval_raw: Option<String>,
},
DropRetentionPolicy {
name: String,
if_exists: bool,
},
AlterRetentionPolicy {
name: String,
action: String,
set_key: Option<String>,
set_value: Option<String>,
},
ShowRetentionPolicies,
CreateChangeStream {
name: String,
collection: String,
with_clause_raw: String,
},
DropChangeStream {
name: String,
if_exists: bool,
},
AlterChangeStream {
name: String,
action: String,
},
ShowChangeStreams,
CreateConsumerGroup {
group_name: String,
stream_name: String,
},
DropConsumerGroup {
name: String,
stream: String,
if_exists: bool,
},
ShowConsumerGroups {
stream: Option<String>,
},
CreateRlsPolicy {
name: String,
collection: String,
policy_type: String,
predicate_raw: String,
is_restrictive: bool,
on_deny_raw: Option<String>,
tenant_id_override: Option<u64>,
},
DropRlsPolicy {
name: String,
collection: String,
if_exists: bool,
},
ShowRlsPolicies {
collection: Option<String>,
},
CreateMaterializedView {
name: String,
source: String,
query_sql: String,
refresh_mode: String,
},
DropMaterializedView {
name: String,
if_exists: bool,
},
ShowMaterializedViews,
CreateContinuousAggregate {
name: String,
source: String,
bucket_raw: String,
aggregate_exprs_raw: String,
group_by: Vec<String>,
with_clause_raw: String,
},
DropContinuousAggregate {
name: String,
if_exists: bool,
},
ShowContinuousAggregates,
CreateDatabase {
name: String,
if_not_exists: bool,
options: Vec<(String, String)>,
},
DropDatabase {
name: String,
if_exists: bool,
cascade: bool,
},
AlterDatabase {
name: String,
operation: AlterDatabaseOperation,
},
ShowDatabases,
ShowDatabaseQuota {
name: String,
},
ShowDatabaseUsage {
name: String,
},
ShowDatabaseLineage {
name: String,
},
AlterTenant {
name: String,
database: String,
operation: AlterTenantOperation,
},
ShowTenantQuotaInDatabase {
name: String,
database: String,
},
ShowTenantUsageInDatabase {
name: String,
database: String,
},
UseDatabase {
name: String,
},
CloneDatabase {
new_name: String,
source_name: String,
as_of: CloneAsOf,
},
MirrorDatabase {
local_name: String,
source_cluster: String,
source_database: String,
mode: nodedb_types::MirrorMode,
},
ShowDatabaseMirrorStatus {
name: Option<String>,
},
MoveTenant {
tenant_name: String,
from_db: String,
to_db: String,
},
BackupDatabase {
name: String,
uri: String,
},
RestoreDatabase {
name: String,
uri: String,
},
BackupTenant {
tenant_id: String,
},
RestoreTenant {
dry_run: bool,
tenant_id: String,
},
ShowNodes,
ShowNode {
node_id: String,
},
RemoveNode {
node_id: String,
},
ShowCluster,
ShowMigrations,
ShowRanges,
ShowRouting,
ShowSchemaVersion,
ShowPeerHealth,
Rebalance,
ShowRaftGroups,
ShowRaftGroup {
group_id: String,
},
AlterRaftGroup {
group_id: String,
action: String,
node_id: String,
},
Analyze {
collection: Option<String>,
},
Compact {
collection: String,
},
ShowStorage {
collection: Option<String>,
},
ShowCompactionStatus,
CreateUser {
username: String,
password: String,
role: Option<String>,
tenant_id: Option<u64>,
},
DropUser {
username: String,
},
AlterUser {
username: String,
op: AlterUserOp,
},
ShowUsers,
AlterRole {
name: String,
sub_op: AlterRoleOp,
},
GrantRole {
role: String,
username: String,
},
RevokeRole {
role: String,
username: String,
},
GrantPermission {
permission: String,
target_type: String,
target_name: String,
grantee: String,
},
GrantDatabasePermission {
permission: String,
db_name: String,
grantee: String,
},
RevokePermission {
permission: String,
target_type: String,
target_name: String,
grantee: String,
},
RevokeDatabasePermission {
permission: String,
db_name: String,
grantee: String,
},
ShowPermissions {
on_collection: Option<String>,
for_grantee: Option<String>,
},
ShowGrants {
username: Option<String>,
},
CreateOidcProvider {
name: String,
issuer: String,
jwks_uri: String,
audience: Option<String>,
claim_mappings: Vec<OidcClaimMappingClause>,
},
AlterOidcProviderClaimMapping {
name: String,
claim_mappings: Vec<OidcClaimMappingClause>,
},
DropOidcProvider {
name: String,
if_exists: bool,
},
ShowOidcProviders,
ShowConflictPolicy {
collection: String,
},
ShowTenants,
ShowAuditLog,
ShowConstraints {
collection: String,
},
ShowTypeGuards {
collection: String,
},
CreateEnumType {
name: String,
labels: Vec<String>,
},
CreateCompositeType {
name: String,
fields: Vec<(String, String)>,
},
DropType {
name: String,
if_exists: bool,
},
AlterTypeAddValue {
type_name: String,
label: String,
},
ShowTypes,
CreateSynonymGroup {
name: String,
terms: Vec<String>,
},
DropSynonymGroup {
name: String,
if_exists: bool,
},
ShowSynonymGroups,
GraphInsertEdge {
collection: String,
src: String,
dst: String,
label: String,
properties: GraphProperties,
},
GraphDeleteEdge {
collection: String,
src: String,
dst: String,
label: String,
},
GraphSetLabels {
node_id: String,
labels: Vec<String>,
remove: bool,
},
GraphTraverse {
start: String,
depth: usize,
edge_label: Option<String>,
direction: GraphDirection,
},
GraphNeighbors {
node: String,
edge_label: Option<String>,
direction: GraphDirection,
},
GraphPath {
src: String,
dst: String,
max_depth: usize,
edge_label: Option<String>,
},
GraphAlgo {
algorithm: String,
collection: String,
edge_label: Option<String>,
damping: Option<f64>,
tolerance: Option<f64>,
resolution: Option<f64>,
max_iterations: Option<usize>,
sample_size: Option<usize>,
source_node: Option<String>,
direction: Option<String>,
mode: Option<String>,
},
MatchQuery {
body: String,
},
GraphRagFusion {
collection: String,
params: crate::ddl_ast::graph_parse::FusionParams,
},
CopyFromFile {
collection: String,
path: String,
format: Option<CopyFormat>,
delimiter: Option<char>,
header: bool,
},
CopyToFile {
source: CopyToSource,
path: String,
format: Option<CopyFormat>,
delimiter: Option<char>,
header: bool,
},
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct OidcClaimMappingClause {
pub claim_name: String,
pub claim_value: String,
pub default_database: Option<u64>,
pub add_databases: Vec<u64>,
pub add_roles: Vec<String>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum CopyToSource {
Collection(String),
Query(String),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum CopyFormat {
Ndjson,
JsonArray,
Csv,
}