pubsub

package
v0.0.0-debug-20260702 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// AccountAll is the value of account_list column in table mo_pubs
	AccountAll = "all"
	// AccountAllOutput is the value of sub_account column of command `show publication`
	AccountAllOutput = "*"
	// TableAll is the value of table_list column in table mo_pubs
	TableAll = "*"
	Sep      = ","
	// PubAllAccounts is the accounts which have privilege to publish to-all publications, separated by comma
	PubAllAccounts = "*"
)

Variables

View Source
var GetAccounts = func(txn executor.TxnExecutor) (nameInfoMap map[string]*AccountInfo, idInfoMap map[int32]*AccountInfo, err error) {
	sql := "select account_id, account_name, status, version, suspended_time from mo_catalog.mo_account where 1=1"

	res, err := txn.Exec(sql, executor.StatementOption{}.WithAccountID(0))
	if err != nil {
		return
	}
	defer res.Close()

	nameInfoMap = make(map[string]*AccountInfo)
	idInfoMap = make(map[int32]*AccountInfo)
	res.ReadRows(func(rows int, cols []*vector.Vector) bool {
		for i := 0; i < rows; i++ {
			var accountInfo AccountInfo
			accountInfo.Id = vector.GetFixedAtWithTypeCheck[int32](cols[0], i)
			accountInfo.Name = cols[1].GetStringAt(i)
			accountInfo.Status = cols[2].GetStringAt(i)
			accountInfo.Version = vector.GetFixedAtWithTypeCheck[uint64](cols[3], i)
			if !cols[4].IsNull(uint64(i)) {
				accountInfo.SuspendedTime = vector.GetFixedAtWithTypeCheck[types.Timestamp](cols[4], i).String2(time.Local, cols[4].GetType().Scale)
			} else {
				accountInfo.SuspendedTime = ""
			}
			nameInfoMap[accountInfo.Name] = &accountInfo
			idInfoMap[accountInfo.Id] = &accountInfo
		}
		return true
	})
	return
}

GetAccounts returns nameInfoMap: map[accName] -> AccountInfo idInfoMap: map[accId] -> AccountInfo

Functions

func AddSingleQuotesJoin

func AddSingleQuotesJoin(s []string) string

func CanPubToAll

func CanPubToAll(accountName, pubAllAccounts string) bool

func InSubMetaTables

func InSubMetaTables(m *plan.SubscriptionMeta, tableName string) bool

func JoinAccountIds

func JoinAccountIds(accIds []int32) (s string)

func JoinAccounts

func JoinAccounts(accountMap map[int32]*AccountInfo) string

func RemoveTable

func RemoveTable(oldTableListStr, tblName string) string

func SplitAccounts

func SplitAccounts(s string) (accounts []string)

Types

type AccountInfo

type AccountInfo struct {
	Id            int32
	Name          string
	Status        string
	Version       uint64
	SuspendedTime string
}

type PubInfo

type PubInfo struct {
	PubAccountId   uint32
	PubAccountName string
	PubName        string
	DbName         string
	DbId           uint64
	TablesStr      string
	SubAccountsStr string
	CreateTime     string
	UpdateTime     string
	Owner          uint32
	Creator        uint32
	Comment        string
}

func (*PubInfo) GetCreateSql

func (pubInfo *PubInfo) GetCreateSql() string

func (*PubInfo) GetSubAccountNames

func (pubInfo *PubInfo) GetSubAccountNames() (names []string)

func (*PubInfo) InSubAccounts

func (pubInfo *PubInfo) InSubAccounts(accountName string) bool

type SubInfo

type SubInfo struct {
	SubAccountId   int32
	SubAccountName string
	SubName        string
	SubTime        string
	PubAccountId   int32
	PubAccountName string
	PubName        string
	PubDbName      string
	PubTables      string
	PubTime        string
	PubComment     string
	Status         SubStatus
}

type SubStatus

type SubStatus int
const (
	SubStatusNormal SubStatus = iota
	SubStatusNotAuthorized
	SubStatusDeleted
)

Jump to

Keyboard shortcuts

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