- Column sort by header click in table view (ASC/DESC/none cycle, server-side) - SQL formatter with Format button and Shift+Alt+F keybinding (sql-formatter) - Table size and row count display in schema tree via pg_class - Insert row dialog with column type hints and auto-skip for identity columns - Saved queries (bookmarks) with CRUD backend, sidebar panel, and save dialog - Active sessions monitor (pg_stat_activity) with auto-refresh, cancel & terminate Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
111 lines
2.8 KiB
Rust
111 lines
2.8 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct DatabaseInfo {
|
|
pub name: String,
|
|
pub owner: String,
|
|
pub encoding: String,
|
|
pub collation: String,
|
|
pub ctype: String,
|
|
pub tablespace: String,
|
|
pub connection_limit: i32,
|
|
pub size: String,
|
|
pub description: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct CreateDatabaseParams {
|
|
pub name: String,
|
|
pub owner: Option<String>,
|
|
pub template: Option<String>,
|
|
pub encoding: Option<String>,
|
|
pub tablespace: Option<String>,
|
|
pub connection_limit: Option<i32>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct RoleInfo {
|
|
pub name: String,
|
|
pub is_superuser: bool,
|
|
pub can_login: bool,
|
|
pub can_create_db: bool,
|
|
pub can_create_role: bool,
|
|
pub inherit: bool,
|
|
pub is_replication: bool,
|
|
pub connection_limit: i32,
|
|
pub password_set: bool,
|
|
pub valid_until: Option<String>,
|
|
pub member_of: Vec<String>,
|
|
pub members: Vec<String>,
|
|
pub description: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct CreateRoleParams {
|
|
pub name: String,
|
|
pub password: Option<String>,
|
|
pub login: bool,
|
|
pub superuser: bool,
|
|
pub createdb: bool,
|
|
pub createrole: bool,
|
|
pub inherit: bool,
|
|
pub replication: bool,
|
|
pub connection_limit: Option<i32>,
|
|
pub valid_until: Option<String>,
|
|
pub in_roles: Vec<String>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct AlterRoleParams {
|
|
pub name: String,
|
|
pub password: Option<String>,
|
|
pub login: Option<bool>,
|
|
pub superuser: Option<bool>,
|
|
pub createdb: Option<bool>,
|
|
pub createrole: Option<bool>,
|
|
pub inherit: Option<bool>,
|
|
pub replication: Option<bool>,
|
|
pub connection_limit: Option<i32>,
|
|
pub valid_until: Option<String>,
|
|
pub rename_to: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct TablePrivilege {
|
|
pub grantee: String,
|
|
pub table_schema: String,
|
|
pub table_name: String,
|
|
pub privilege_type: String,
|
|
pub is_grantable: bool,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct SessionInfo {
|
|
pub pid: i32,
|
|
pub usename: Option<String>,
|
|
pub datname: Option<String>,
|
|
pub state: Option<String>,
|
|
pub query: Option<String>,
|
|
pub query_start: Option<String>,
|
|
pub wait_event_type: Option<String>,
|
|
pub wait_event: Option<String>,
|
|
pub client_addr: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct GrantRevokeParams {
|
|
pub action: String,
|
|
pub privileges: Vec<String>,
|
|
pub object_type: String,
|
|
pub object_name: String,
|
|
pub role_name: String,
|
|
pub with_grant_option: bool,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct RoleMembershipParams {
|
|
pub action: String,
|
|
pub role_name: String,
|
|
pub member_name: String,
|
|
}
|