service

package
v0.0.0-...-9275f24 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SecretSvcIns = &SecretSvc{}
View Source
var ServerIpListSvcIns = &ServerIpListSvc{}
View Source
var ServerSvcIns = &ServerSvc{}

Functions

func AddAccessTokenToCache

func AddAccessTokenToCache(accessToken string, m *model.AccessToken)

AddAccessTokenToCache 增加access token到缓存

func AnalysisAccessToken

func AnalysisAccessToken(accessToken string) (*model.AccessToken, error)

AnalysisAccessToken 解析access token

func DoubleWrite

func DoubleWrite(storeDetectionEventChan chan<- struct{}, exec, execBackup doubleWriteFunc) error

DoubleWrite 主备写

func FetchLocalStore

func FetchLocalStore() []store.LoadAllFunc

func FetchSvcStores

func FetchSvcStores(typ string) []store.HealthFunc

FetchSvcStores 通过类型获取svc store

func GenAccessToken

func GenAccessToken(serverSign string) (accessToken string, m *model.AccessToken, err error)

GenAccessToken 生成access token serverSign 接入服务的标识 key,iv 系统根密钥,防伪造

func GetAccessTokenInCache

func GetAccessTokenInCache(accessToken string) *model.AccessToken

GetAccessTokenInCache 在缓存中获取access token

func Initialize

func Initialize(storeDetectionEventChan chan<- struct{})

func LoadAllData

func LoadAllData()

func MultiStoreDelete

func MultiStoreDelete(ctx context.Context, storeDetectionEventChan chan<- struct{}, ID int64, stores ...store.DeleteFunc) error

func MultiStoreInsert

func MultiStoreInsert[T any](ctx context.Context, storeDetectionEventChan chan<- struct{}, m T, stores ...store.InsertFunc[T]) error

MultiStoreInsert 多store insert

func MultiStorePaging

func MultiStorePaging[P any, R any](ctx context.Context, storeDetectionEventChan chan<- struct{}, p P, stores ...store.PagingFunc[P, R]) (result []R, count int64, err error)

func MultiStoreSelectByCondition

func MultiStoreSelectByCondition[P any, R any](ctx context.Context, storeDetectionEventChan chan<- struct{}, p P, stores ...store.SelectFunc[P, R]) (result []R, err error)

MultiStoreSelectByCondition 多store 条件查询

func MultiStoreUpdate

func MultiStoreUpdate(ctx context.Context, storeDetectionEventChan chan<- struct{}, ID int64, params map[string]any, stores ...store.UpdateFunc) error

func ValidCode

func ValidCode(ctx context.Context, account, code string) (bool, error)

func VerifyAccessTokenM

func VerifyAccessTokenM(tokenM *model.AccessToken) error

VerifyAccessTokenM 验证access token 验证有效期

Types

type SecretSvc

type SecretSvc struct {
	Store       store.SecretStore // 主存储
	StoreBackup store.SecretStore // 备存储
	StoreMemory store.SecretStore // 内存存储
	// contains filtered or unexported fields
}

func (*SecretSvc) Add

func (s *SecretSvc) Add(ctx context.Context, account string, isEnable uint8) error

Add 添加账号密钥

func (*SecretSvc) CalcDataCheckSum

func (s *SecretSvc) CalcDataCheckSum(isEnable uint8, account, secretSeedCipher string) string

CalcDataCheckSum 计算数据校验和

func (*SecretSvc) CheckModel

func (s *SecretSvc) CheckModel(m *model.AccountSecretModel, isDecrypt bool) error

CheckModel 校验数据,解密账号密钥密文

func (*SecretSvc) GetByAccount

func (s *SecretSvc) GetByAccount(ctx context.Context, account string, isDecrypt bool) (*model.AccountSecretModel, error)

GetByAccount 通过账号获取密钥信息,密钥已解密 isDecrypt 是否解密账号密钥

func (*SecretSvc) IsExists

func (s *SecretSvc) IsExists(ctx context.Context, account string) (bool, error)

IsExists 账号密钥是否存在

func (*SecretSvc) NewSecretModel

func (s *SecretSvc) NewSecretModel(account string, isEnable uint8) (*model.AccountSecretModel, error)

NewSecretModel 创建一个新的账号密钥model

func (*SecretSvc) Paging

func (s *SecretSvc) Paging(ctx context.Context, p *param.SecretPagingParam) (result []*model.AccountSecretModel, count int64, err error)

Paging 分页

func (*SecretSvc) SetEnable

func (s *SecretSvc) SetEnable(ctx context.Context, account string, isEnable uint8) error

type ServerIpListSvc

type ServerIpListSvc struct {
	Store       store.ServerIpListStore // 主存储
	StoreBackup store.ServerIpListStore // 备存储
	StoreMemory store.ServerIpListStore // 内存存储
	// contains filtered or unexported fields
}

func (*ServerIpListSvc) Add

func (*ServerIpListSvc) GetBySign

func (s *ServerIpListSvc) GetBySign(ctx context.Context, serverSign string) ([]*model.ServerIpListModel, error)

func (*ServerIpListSvc) Remove

type ServerSvc

type ServerSvc struct {
	Store       store.ServerStore // 主存储
	StoreBackup store.ServerStore // 备存储
	StoreMemory store.ServerStore // 内存存储
	// contains filtered or unexported fields
}

func (*ServerSvc) Add

func (s *ServerSvc) Add(ctx context.Context, p *param.ServerParam) error

Add 增加接入的服务

func (*ServerSvc) CalcDataCheckSum

func (s *ServerSvc) CalcDataCheckSum(m *model.ServerModel) string

CalcDataCheckSum 计算数据校验和

func (*ServerSvc) CheckModel

func (s *ServerSvc) CheckModel(m *model.ServerModel, isDecrypt bool) error

CheckModel 校验数据 isDecrypt 解密服务密钥密文和IV密文

func (*ServerSvc) EditBase

func (s *ServerSvc) EditBase(ctx context.Context, p *param.ServerParam) error

func (*ServerSvc) GetBySign

func (s *ServerSvc) GetBySign(ctx context.Context, sign string, isDecrypt bool) (*model.ServerModel, error)

func (*ServerSvc) IsExists

func (s *ServerSvc) IsExists(ctx context.Context, sign string) (bool, error)

IsExists 账号密钥是否存在

func (*ServerSvc) NewServerModel

func (s *ServerSvc) NewServerModel(p *param.ServerParam) (*model.ServerModel, error)

func (*ServerSvc) Paging

func (s *ServerSvc) Paging(ctx context.Context, p *param.ServerPagingParam) (result []*model.ServerModel, count int64, err error)

Paging 分页

func (*ServerSvc) SetEnable

func (s *ServerSvc) SetEnable(ctx context.Context, p *param.ServerParam) error

SetEnable 更新启用状态和操作敏感信息状态

Jump to

Keyboard shortcuts

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