service

package
v1.2210.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CbRootUri  = "/sql_query"
	CbGqlApi   = "/api/gql"
	CBUserRole = "user"
)
View Source
const (
	GetUserConnectionsQuery = `` /* 231-byte string literal not displayed */

	SetUserConnectionsQuery = `` /* 169-byte string literal not displayed */

)
View Source
const (
	IsUserExistQuery = `` /* 143-byte string literal not displayed */

	UpdatePasswordQuery = `` /* 172-byte string literal not displayed */

	CreateUserQuery = `` /* 156-byte string literal not displayed */

	GrantUserRoleQuery = `
query grantUserRole($userId: ID!, $roleId: ID!) {
  grantUserRole(userId: $userId, roleId: $roleId)
}`
)
View Source
const CBNamePrefix = "sqle-"
View Source
const (
	CreateConnectionQuery = `` /* 240-byte string literal not displayed */

)
View Source
const (
	GetActiveUserQuery = `
	query getActiveUser {
  		user: activeUser {
    		userId
  		}
	}
`
)
View Source
const LoginQuery = `` /* 189-byte string literal not displayed */
View Source
const (
	UpdateConnectionQuery = `` /* 240-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func AddCloudBeaverInstance

func AddCloudBeaverInstance(client *gqlClient.Client, sqleInst *sqleModel.Instance) error

AddCloudBeaverInstance 添加实例后会同步缓存

func GenerateCloudBeaverDriverID

func GenerateCloudBeaverDriverID(sqleInst *sqleModel.Instance) (string, error)

func GenerateCloudBeaverInstanceParams added in v1.2210.0

func GenerateCloudBeaverInstanceParams(sqleInst *sqleModel.Instance) (map[string]interface{}, error)

func GenerateCloudBeaverUserName

func GenerateCloudBeaverUserName(name string) string

func GetCurrentCloudBeaverUserID

func GetCurrentCloudBeaverUserID(ctx echo.Context) (string, bool, error)

func GetGQLClient

func GetGQLClient(username, password string) (*gqlClient.Client, error)

func GetGQLClientWithRootUser

func GetGQLClientWithRootUser() (*gqlClient.Client, error)

func GetGqlServerURI

func GetGqlServerURI() string

func GetSQLEGQLClientWithCurrentUser

func GetSQLEGQLClientWithCurrentUser(ctx echo.Context) (*gqlClient.Client, error)

func GetSQLEGqlServerURI

func GetSQLEGqlServerURI() string

func InitSQLQueryConfig

func InitSQLQueryConfig(sqlePort int, sqleEnableHttps bool, c config.SQLQueryConfig)

func IsCloudBeaverConfigured

func IsCloudBeaverConfigured() bool

func IsReserved

func IsReserved(name string) bool

IsReserved 会检查用户名是否为无法使用的名称, 比如admin和user是角色名, 按照CloudBeaver的要求角色名无法作为用户名

func Login

func Login(user, pwd string) (cookie []*http.Cookie, err error)

func LoginToCBServer

func LoginToCBServer(user, pwd string) (cookie []*http.Cookie, err error)

LoginToCBServer 的登录请求会直接被转发, 不会被中间件拦截处理

func RestoreFromCloudBeaverUserName

func RestoreFromCloudBeaverUserName(name string) string

func SyncCurrentUser

func SyncCurrentUser(cloudBeaverUser string) error

func SyncInstance

func SyncInstance(sqleInstances map[uint]*sqleModel.Instance) error

func SyncUserBindInstance

func SyncUserBindInstance(cbUserID string) error

func SyncVisibleInstance

func SyncVisibleInstance(cbUserCache *sqleModel.CloudBeaverUserCache, sqleUser *sqleModel.User, sqleInstances map[uint]*sqleModel.Instance) error

func UpdateCloudBeaverInstance

func UpdateCloudBeaverInstance(client *gqlClient.Client, cbInstID string, sqleInst *sqleModel.Instance) error

UpdateCloudBeaverInstance 更新完毕后会同步缓存

Types

type AuditResult

type AuditResult struct {
	Result     string
	LimitLevel string
	AuditLevel string
}

func AuditSQL

func AuditSQL(sql string, connectionID string) (auditSuccess bool, result *AuditResult, err error)

type SQLQueryConfig

type SQLQueryConfig struct {
	config.SQLQueryConfig
	SqlePort        int
	SqleEnableHttps bool
}

func GetSQLQueryConfig

func GetSQLQueryConfig() *SQLQueryConfig

Jump to

Keyboard shortcuts

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