sql_workbench

package
v0.0.0-...-b98e673 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2026 License: MPL-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ODCSessionCookieName   = "JSESSIONID"
	ODCXsrfTokenCookieName = "XSRF-TOKEN"
)

ODC 会话相关的 cookie 名称

View Source
const INDIVIDUAL_SPACE = 4
View Source
const SQL_WORKBENCH_DEFAULT_PASSWORD = "DMS123__"
View Source
const SQL_WORKBENCH_PREFIX = "DMS-"
View Source
const SQL_WORKBENCH_REAL_PASSWORD = "DMS123__@"
View Source
const SQL_WORKBENCH_URL = "/odc_query"

Variables

This section is empty.

Functions

func GetDataMaskingMiddleware

func GetDataMaskingMiddleware(config DataMaskingMiddlewareConfig) echo.MiddlewareFunc

GetDataMaskingMiddleware 返回用于脱敏的中间件

func GetOperationLogBodyDumpMiddleware

func GetOperationLogBodyDumpMiddleware(config OperationLogMiddlewareConfig) echo.MiddlewareFunc

GetOperationLogBodyDumpMiddleware 返回用于记录操作日志的 BodyDump 中间件

func GetUnmaskingWorkflowMiddleware

func GetUnmaskingWorkflowMiddleware(config DataMaskingMiddlewareConfig) echo.MiddlewareFunc

GetUnmaskingWorkflowMiddleware 处理获批后查看原文,执行 SQL 之前进行替换

Types

type AccountInfo

type AccountInfo struct {
	User     string `json:"user"`
	Hostname string `json:"hostname"`
	Password string `json:"password"`
}

AccountInfo 账号信息

type DataMaskingMiddlewareConfig

type DataMaskingMiddlewareConfig struct {
	SqlResultMasker          sqlresultmasker.SQLResultMasker
	DBServiceUsecase         *biz.DBServiceUsecase
	SqlWorkbenchService      *SqlWorkbenchService
	UnmaskingWorkflowUsecase *dataMaskingBiz.UnmaskingWorkflowUsecase
}

DataMaskingMiddlewareConfig 配置脱敏中间件

type ListDBAccountReply

type ListDBAccountReply struct {
	Data    []*TempDBAccount `json:"data"`
	Code    int              `json:"code"`
	Message string           `json:"message"`
}

ListDBAccountReply 数据库账号列表响应

type OperationLogMiddlewareConfig

type OperationLogMiddlewareConfig struct {
	CbOperationLogUsecase *biz.CbOperationLogUsecase
	DBServiceUsecase      *biz.DBServiceUsecase
	SqlWorkbenchService   *SqlWorkbenchService
}

OperationLogMiddlewareConfig 配置操作日志中间件

type SQLEAuditResultSummary

type SQLEAuditResultSummary struct {
	AuditLevel string  `json:"audit_level"`
	Score      int32   `json:"score"`
	PassRate   float64 `json:"pass_rate"`
}

SQLEAuditResultSummary SQLE 审核结果汇总

type SqlWorkbenchService

type SqlWorkbenchService struct {
	// contains filtered or unexported fields
}

func NewAndInitSqlWorkbenchService

func NewAndInitSqlWorkbenchService(logger utilLog.Logger, opts *conf.DMSOptions) (*SqlWorkbenchService, error)

func (*SqlWorkbenchService) AuditMiddleware

func (sqlWorkbenchService *SqlWorkbenchService) AuditMiddleware() echo.MiddlewareFunc

AuditMiddleware 拦截工作台odc请求进行加工

func (*SqlWorkbenchService) GetOdcProxyTarget

func (sqlWorkbenchService *SqlWorkbenchService) GetOdcProxyTarget() ([]*middleware.ProxyTarget, error)

func (*SqlWorkbenchService) GetRootUri

func (sqlWorkbenchService *SqlWorkbenchService) GetRootUri() string

func (*SqlWorkbenchService) GetSqlResultMasker

func (sqlWorkbenchService *SqlWorkbenchService) GetSqlResultMasker() sqlresultmasker.SQLResultMasker

func (*SqlWorkbenchService) IsConfigured

func (sqlWorkbenchService *SqlWorkbenchService) IsConfigured() bool

func (*SqlWorkbenchService) Login

func (sqlWorkbenchService *SqlWorkbenchService) Login() echo.MiddlewareFunc

func (*SqlWorkbenchService) ResetDbServiceByAuth

func (sqlWorkbenchService *SqlWorkbenchService) ResetDbServiceByAuth(ctx context.Context, activeDBServices []*biz.DBService, userId string) ([]*biz.DBService, error)

func (*SqlWorkbenchService) SetSqlResultMasker

func (sqlWorkbenchService *SqlWorkbenchService) SetSqlResultMasker(masker sqlresultmasker.SQLResultMasker)

func (*SqlWorkbenchService) SupportDBType

func (sqlWorkbenchService *SqlWorkbenchService) SupportDBType(dbType pkgConst.DBType) bool

type StreamExecuteData

type StreamExecuteData struct {
	ApprovalRequired        bool                   `json:"approvalRequired"`
	LogicalSQL              bool                   `json:"logicalSql"`
	RequestID               *string                `json:"requestId"`
	SQLs                    []StreamExecuteSQLItem `json:"sqls"`
	UnauthorizedDBResources interface{}            `json:"unauthorizedDBResources"`
	ViolatedRules           []interface{}          `json:"violatedRules"`
}

StreamExecuteData streamExecute 响应中的 data 字段

type StreamExecuteResponse

type StreamExecuteResponse struct {
	Data           StreamExecuteData `json:"data"`
	DurationMillis int64             `json:"durationMillis"`
	HTTPStatus     string            `json:"httpStatus"`
	RequestID      string            `json:"requestId"`
	Server         string            `json:"server"`
	Successful     bool              `json:"successful"`
	Timestamp      float64           `json:"timestamp"`
	TraceID        string            `json:"traceId"`
}

StreamExecuteResponse streamExecute 接口响应结构

type StreamExecuteResponseWriter

type StreamExecuteResponseWriter struct {
	echo.Response
	Buffer   *bytes.Buffer
	Original http.ResponseWriter
	Status   int
}

StreamExecuteResponseWriter 响应拦截器,用于捕获响应内容

func NewStreamExecuteResponseWriter

func NewStreamExecuteResponseWriter(c echo.Context) *StreamExecuteResponseWriter

func (*StreamExecuteResponseWriter) Write

func (w *StreamExecuteResponseWriter) Write(b []byte) (int, error)

func (*StreamExecuteResponseWriter) WriteHeader

func (w *StreamExecuteResponseWriter) WriteHeader(code int)

type StreamExecuteRule

type StreamExecuteRule struct {
	AppliedDialectTypes interface{}            `json:"appliedDialectTypes"`
	CreateTime          interface{}            `json:"createTime"`
	Enabled             interface{}            `json:"enabled"`
	ID                  interface{}            `json:"id"`
	Level               int                    `json:"level"`
	Metadata            interface{}            `json:"metadata"`
	OrganizationID      interface{}            `json:"organizationId"`
	Properties          interface{}            `json:"properties"`
	RulesetID           interface{}            `json:"rulesetId"`
	UpdateTime          interface{}            `json:"updateTime"`
	Violation           StreamExecuteViolation `json:"violation"`
}

StreamExecuteRule 违反的规则

type StreamExecuteSQLItem

type StreamExecuteSQLItem struct {
	SQLTuple      StreamExecuteSQLTuple `json:"sqlTuple"`
	ViolatedRules []StreamExecuteRule   `json:"violatedRules"`
}

StreamExecuteSQLItem SQL 条目

type StreamExecuteSQLTuple

type StreamExecuteSQLTuple struct {
	ExecutedSQL string `json:"executedSql"`
	Offset      int    `json:"offset"`
	OriginalSQL string `json:"originalSql"`
	SQLID       string `json:"sqlId"`
}

StreamExecuteSQLTuple SQL 元组

type StreamExecuteViolation

type StreamExecuteViolation struct {
	Level            int    `json:"level"`
	LocalizedMessage string `json:"localizedMessage"`
	Offset           int    `json:"offset"`
	Start            int    `json:"start"`
	Stop             int    `json:"stop"`
	Text             string `json:"text"`
}

StreamExecuteViolation 违反详情

type TempDBAccount

type TempDBAccount struct {
	DBAccountUid string            `json:"db_account_uid"`
	AccountInfo  AccountInfo       `json:"account_info"`
	Explanation  string            `json:"explanation"`
	ExpiredTime  string            `json:"expired_time"`
	DbService    dmsV1.UidWithName `json:"db_service"`
}

TempDBAccount 临时数据库账号

func ListAuthDbAccount

func ListAuthDbAccount(ctx context.Context, baseURL, projectUid, userId string) ([]*TempDBAccount, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL