idmap

package
v0.0.0-...-8dd6aec Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBName       = "idmap.db"
	BucketName   = "ids"
	ConfigBucket = "config"
	CounterKey   = "currentRow"
)

Variables

View Source
var (
	// 用于存储临时指令的全局变量
	TemporaryCommands []string
	// 用于保证线程安全的互斥锁
	MutexT sync.Mutex
)
View Source
var ErrKeyNotFound = errors.New("key not found")

Functions

func CheckValue

func CheckValue(id string, value int64) bool

检查id和value是否是转换关系

func CheckValuev2

func CheckValuev2(value int64) bool

func CloseDB

func CloseDB()

func FindKeysBySubAndType

func FindKeysBySubAndType(sub string, typeSuffix string) ([]string, error)

sub 要匹配的类型 typesuffix 相当于:type 的type

func FindSubKeysById

func FindSubKeysById(id string) ([]string, error)

取相同前缀下的所有key的:后边 比如取群成员列表

func FindSubKeysByIdPro

func FindSubKeysByIdPro(id string) ([]string, error)

FindSubKeysByIdPro 根据1个值获取key中的k:v给出k获取所有v,通过网络调用

func GenerateRowID

func GenerateRowID(id string, length int) (int64, error)

func InitializeDB

func InitializeDB()

func ReadConfig

func ReadConfig(sectionName, keyName string) (string, error)

根据a和b取出c

func ReadConfigv2

func ReadConfigv2(sectionName, keyName string) (string, error)

ReadConfigv2 根据a和b取出c

func RetrieveRealValue

func RetrieveRealValue(virtualValue int64) (string, string, error)

RetrieveRealValue 根据虚拟值获取真实值,并返回虚拟值及其对应的真实值

func RetrieveRealValuePro

func RetrieveRealValuePro(virtualValue1, virtualValue2 int64) (string, string, error)

RetrieveRealValuePro 根据两个虚拟值获取相应的两个真实值 群号 然后 用户号

func RetrieveRealValuesv2Pro

func RetrieveRealValuesv2Pro(virtualValue int64, virtualValueSub int64) (string, string, error)

RetrieveRealValuesv2Pro 根据两个虚拟值获取两个真实值 群号 然后 用户号

func RetrieveRealValuev2

func RetrieveRealValuev2(virtualValue int64) (string, string, error)

RetrieveRealValuev2 根据虚拟值获取真实值

func RetrieveRowByID

func RetrieveRowByID(rowid string) (string, error)

根据b得到a

func RetrieveRowByIDPro

func RetrieveRowByIDPro(newRowID, newSubRowID string) (string, string, error)

群号 还有用户号

func RetrieveRowByIDv2

func RetrieveRowByIDv2(rowid string) (string, error)

RetrieveRowByIDv2 根据b得到a

func RetrieveRowByIDv2Pro

func RetrieveRowByIDv2Pro(newRowID string, newSubRowID string) (string, string, error)

群号 然后 用户号

func RetrieveVirtualValue

func RetrieveVirtualValue(realValue string) (string, string, error)

RetrieveVirtualValue 根据真实值获取虚拟值,并返回真实值及其对应的虚拟值

func RetrieveVirtualValuePro

func RetrieveVirtualValuePro(realValue string, realValueSub string) (string, string, error)

根据2个真实值 获取2个虚拟值 群号 然后 用户号

func RetrieveVirtualValuev2

func RetrieveVirtualValuev2(realValue string) (string, string, error)

RetrieveVirtualValuev2 根据真实值获取虚拟值

func RetrieveVirtualValuev2Pro

func RetrieveVirtualValuev2Pro(realValue string, realValueSub string) (string, string, error)

根据2个真实值 获取2个虚拟值 群号 然后 用户号

func SimplifiedStoreID

func SimplifiedStoreID(id string) (int64, error)

func SimplifiedStoreIDv2

func SimplifiedStoreIDv2(id string) (int64, error)

SimplifiedStoreID 根据a储存b 储存一半

func StoreID

func StoreID(id string) (int64, error)

根据a储存b

func StoreIDPro

func StoreIDPro(id string, subid string) (int64, int64, error)

群号 然后 用户号

func StoreIDv2

func StoreIDv2(id string) (int64, error)

StoreIDv2 根据a储存b

func StoreIDv2Pro

func StoreIDv2Pro(id string, subid string) (int64, int64, error)

群号 然后 用户号

func UpdateKeysWithNewID

func UpdateKeysWithNewID(id, newID string) error

场景: xxx:yyy zzz:bbb zzz:bbb xxx:yyy 把xxx(id)替换为newID 比如更换群号(会卡住)

func UpdateVirtualValue

func UpdateVirtualValue(oldRowValue, newRowValue int64) error

UpdateVirtualValue 更新旧的虚拟值到新的虚拟值的映射

func UpdateVirtualValuePro

func UpdateVirtualValuePro(oldVirtualValue1, newVirtualValue1, oldVirtualValue2, newVirtualValue2 int64) error

UpdateVirtualValuePro 更新一对旧虚拟值到新虚拟值的映射 旧群号 新群号 旧用户 新用户

func UpdateVirtualValuev2

func UpdateVirtualValuev2(oldRowValue, newRowValue int64) error

更新真实值对应的虚拟值

func UpdateVirtualValuev2Pro

func UpdateVirtualValuev2Pro(oldVirtualValue1, newVirtualValue1, oldVirtualValue2, newVirtualValue2 int64) error

UpdateVirtualValuev2Pro 根据配置更新两对虚拟值 旧群 新群 旧用户 新用户

func WriteConfig

func WriteConfig(sectionName, keyName, value string) error

根据a 以b为类别 储存c

func WriteConfigv2

func WriteConfigv2(sectionName, keyName, value string) error

WriteConfigv2 根据a以b为类别储存c

Types

This section is empty.

Jump to

Keyboard shortcuts

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