mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-02 23:06:36 +08:00
db manager
This commit is contained in:
@@ -73,6 +73,61 @@ definitions:
|
||||
- solutions
|
||||
- token
|
||||
type: object
|
||||
db_manage.DBOverviewResponse:
|
||||
properties:
|
||||
connections:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
size:
|
||||
type: string
|
||||
table_count:
|
||||
type: integer
|
||||
type:
|
||||
type: string
|
||||
version:
|
||||
type: string
|
||||
type: object
|
||||
db_manage.ExecuteSQLRequest:
|
||||
properties:
|
||||
sql:
|
||||
type: string
|
||||
required:
|
||||
- sql
|
||||
type: object
|
||||
db_manage.ExecuteSQLResponse:
|
||||
properties:
|
||||
affected_rows:
|
||||
type: integer
|
||||
columns:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
execution_time_ms:
|
||||
type: integer
|
||||
results:
|
||||
items:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
type: array
|
||||
type:
|
||||
description: '"select" 或 "exec"'
|
||||
type: string
|
||||
type: object
|
||||
db_manage.TableDataResponse:
|
||||
properties:
|
||||
columns:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
results:
|
||||
items:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
type: array
|
||||
total:
|
||||
type: integer
|
||||
type: object
|
||||
logger.LogEntry:
|
||||
properties:
|
||||
data:
|
||||
@@ -1233,6 +1288,167 @@ paths:
|
||||
summary: 获取数据库信息
|
||||
tags:
|
||||
- admin
|
||||
/api/v1/admin/db-manage/overview:
|
||||
get:
|
||||
description: 获取数据库类型、版本、名称、文件大小、表数量及当前连接数,需要管理员权限
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 获取成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/util.ResponseAny'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/db_manage.DBOverviewResponse'
|
||||
type: object
|
||||
"401":
|
||||
description: 未登录
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
"403":
|
||||
description: 无管理员权限
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
"500":
|
||||
description: 内部错误
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
security:
|
||||
- SessionCookie: []
|
||||
summary: 获取数据库运行概览
|
||||
tags:
|
||||
- admin
|
||||
/api/v1/admin/db-manage/query:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 在当前数据库中执行任意自定义 SQL,如果是查询语句将返回格式化后的列与数据集,否则返回受影响行数,需要管理员权限
|
||||
parameters:
|
||||
- description: SQL 请求参数
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/db_manage.ExecuteSQLRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 执行完毕
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/util.ResponseAny'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/db_manage.ExecuteSQLResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: SQL 语句错误
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
"401":
|
||||
description: 未登录
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
"403":
|
||||
description: 无管理员权限
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
"500":
|
||||
description: 内部错误
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
security:
|
||||
- SessionCookie: []
|
||||
summary: 执行 SQL 查询
|
||||
tags:
|
||||
- admin
|
||||
/api/v1/admin/db-manage/table-data:
|
||||
get:
|
||||
description: 根据传入的数据表名称进行分页数据查询,返回表结构列名及动态行数据,需要管理员权限
|
||||
parameters:
|
||||
- description: 表名称
|
||||
in: query
|
||||
name: table
|
||||
required: true
|
||||
type: string
|
||||
- description: 页码,默认 1
|
||||
in: query
|
||||
name: page
|
||||
type: integer
|
||||
- description: 每页大小,默认 10
|
||||
in: query
|
||||
name: pageSize
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 获取成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/util.ResponseAny'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/db_manage.TableDataResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: 参数错误
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
"401":
|
||||
description: 未登录
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
"403":
|
||||
description: 无管理员权限
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
"500":
|
||||
description: 内部错误
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
security:
|
||||
- SessionCookie: []
|
||||
summary: 获取数据表数据
|
||||
tags:
|
||||
- admin
|
||||
/api/v1/admin/db-manage/tables:
|
||||
get:
|
||||
description: 返回当前数据库的所有用户自定义表名称列表,需要管理员权限
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 获取成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/util.ResponseAny'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
"401":
|
||||
description: 未登录
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
"403":
|
||||
description: 无管理员权限
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
"500":
|
||||
description: 内部错误
|
||||
schema:
|
||||
$ref: '#/definitions/util.ResponseAny'
|
||||
security:
|
||||
- SessionCookie: []
|
||||
summary: 获取数据库所有表名
|
||||
tags:
|
||||
- admin
|
||||
/api/v1/admin/logs:
|
||||
get:
|
||||
description: 分页获取系统历史日志,cursor=0 获取最新日志,cursor>0 获取更早日志
|
||||
|
||||
Reference in New Issue
Block a user