register

package
v1.0.16 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	IMDatasourceTypeNone        IMDatasourceType = iota
	IMDatasourceTypeSubscribers                  = 1
	IMDatasourceTypeChannelInfo                  = 1 << 1
	IMDatasourceTypeBlacklist                    = 1 << 2
	IMDatasourceTypeWhitelist                    = 1 << 3
	IMDatasourceTypeSystemUIDs                   = 1 << 4
)

Variables

View Source
var (
	ErrDatasourceNotProcess error = errors.New("datasource not process")
)

Functions

func AddModule

func AddModule(moduleFnc func(ctx interface{}) Module)

func GetService

func GetService(name string) interface{}

GetService 获取服务

Types

type APIRouter

type APIRouter interface {
	Route(r *wkhttp.WKHttp)
}

APIRouter api路由者

type BussDataSource

type BussDataSource struct {
	// 获取频道详情
	ChannelGet func(channelID string, channelType uint8, loginUID string) (*model.ChannelResp, error)
}

type IMDatasource

type IMDatasource struct {
	// 是否存在数据
	HasData func(channelID string, channelType uint8) IMDatasourceType
	// 获取订阅者
	Subscribers func(channelID string, channelType uint8) ([]string, error)
	// 获取频道信息
	ChannelInfo func(channelID string, channelType uint8) (map[string]interface{}, error)
	// 黑名单列表
	Blacklist func(channelID string, channelType uint8) ([]string, error)
	// 白名单列表
	Whitelist func(channelID string, channelType uint8) ([]string, error)
	// 系统账号
	SystemUIDs func() ([]string, error)
}

type IMDatasourceType

type IMDatasourceType int

func (IMDatasourceType) Has

type Module

type Module struct {
	// 模块名称
	Name string
	// api 路由
	SetupAPI func() APIRouter
	// task 路由
	SetupTask func() TaskRouter
	// 服务
	// sql目录
	SQLDir *SqlFS
	// swagger文件
	Swagger string
	// im 数据源
	IMDatasource IMDatasource
	// 业务数据源
	BussDataSource BussDataSource
	// 服务
	Service interface{}
	// 事件
	Start func() error
	Stop  func() error
}

模块

func GetModuleByName

func GetModuleByName(name string, ctx any) Module

func GetModules

func GetModules(ctx any) []Module

type ModuleFnc

type ModuleFnc func(ctx interface{}) Module

type SqlFS added in v1.0.8

type SqlFS struct {
	embed.FS
}

func NewSqlFS added in v1.0.8

func NewSqlFS(fs embed.FS) *SqlFS

type TaskRouter

type TaskRouter interface {
	RegisterTasks()
}

TaskRouter task路由者

Jump to

Keyboard shortcuts

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