models

package
v0.9.2-beta.14 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: AGPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PRIMARY   = "primary"
	SECONDARY = "secondary"
	MASTER    = "master"
	SLAVE     = "slave"
	LEADER    = "Leader"
	FOLLOWER  = "Follower"
	LEARNER   = "Learner"
	CANDIDATE = "Candidate"
)

Variables

View Source
var (
	ErrNoSQL           = fmt.Errorf(errMsgNoSQL)
	ErrNoUserName      = fmt.Errorf(errMsgNoUserName)
	ErrNoPassword      = fmt.Errorf(errMsgNoPassword)
	ErrNoRoleName      = fmt.Errorf(errMsgNoRoleName)
	ErrInvalidRoleName = fmt.Errorf(errMsgInvalidRoleName)
	ErrNoSuchUser      = fmt.Errorf(errMsgNoSuchUser)
	ErrNotImplemented  = fmt.Errorf(errMsgNotImplemented)
)

Functions

func ClientTypes

func ClientTypes() []string

func IsLikelyPrimaryRole added in v0.8.4

func IsLikelyPrimaryRole(role string) bool

IsLikelyPrimaryRole returns true if the role is primary, it is used for the case where db manager do not implemement the IsLeader method. use it curefully, as it is for normal case, and may be wrong for some special cases.

func SortRoleByWeight

func SortRoleByWeight(r1, r2 RoleType) bool

Types

type ClientType

type ClientType string
const (
	CLI     ClientType = "cli"
	DJANGO  ClientType = "django"
	DOTNET  ClientType = ".net"
	GO      ClientType = "go"
	JAVA    ClientType = "java"
	NODEJS  ClientType = "node.js"
	PHP     ClientType = "php"
	PRISMA  ClientType = "prisma"
	PYTHON  ClientType = "python"
	RAILS   ClientType = "rails"
	RUST    ClientType = "rust"
	SYMFONY ClientType = "symfony"
)

func (ClientType) String

func (t ClientType) String() string

type EngineType

type EngineType string
const (
	MySQL              EngineType = "mysql"
	WeSQL              EngineType = "wesql"
	PostgreSQL         EngineType = "postgresql"
	OfficialPostgreSQL EngineType = "official-postgresql"
	ApecloudPostgreSQL EngineType = "apecloud-postgresql"
	Redis              EngineType = "redis"
	ETCD               EngineType = "etcd"
	MongoDB            EngineType = "mongodb"
	Nebula             EngineType = "nebula"
	PolarDBX           EngineType = "polardbx"
	PulsarBroker       EngineType = "pulsar-broker"
	PulsarProxy        EngineType = "pulsar-proxy"
	FoxLake            EngineType = "foxlake"
	Oceanbase          EngineType = "oceanbase"
	Oracle             EngineType = "oracle"
	OpenGauss          EngineType = "opengauss"
	Custom             EngineType = "custom"
)

type RoleType

type RoleType string
const (
	SuperUserRole  RoleType = "superuser"
	ReadWriteRole  RoleType = "readwrite"
	ReadOnlyRole   RoleType = "readonly"
	NoPrivileges   RoleType = ""
	CustomizedRole RoleType = "customized"
	InvalidRole    RoleType = "invalid"
)

func String2RoleType

func String2RoleType(roleName string) RoleType

func (RoleType) EqualTo

func (r RoleType) EqualTo(role string) bool

func (RoleType) GetWeight

func (r RoleType) GetWeight() int32

type UserInfo

type UserInfo struct {
	UserName  string        `json:"userName"`
	Password  string        `json:"password,omitempty"`
	Statement string        `json:"statement,omitempty"`
	Expired   string        `json:"expired,omitempty"`
	ExpireAt  time.Duration `json:"expireAt,omitempty"`
	RoleName  string        `json:"roleName,omitempty"`
}

UserInfo is the user information for account management

func (*UserInfo) PasswdValidator

func (user *UserInfo) PasswdValidator() error

func (*UserInfo) RoleValidator

func (user *UserInfo) RoleValidator() error

func (*UserInfo) UserNameAndPasswdValidator

func (user *UserInfo) UserNameAndPasswdValidator() error

func (*UserInfo) UserNameAndRoleValidator

func (user *UserInfo) UserNameAndRoleValidator() error

func (*UserInfo) UserNameValidator

func (user *UserInfo) UserNameValidator() error

Jump to

Keyboard shortcuts

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