application

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 22 Imported by: 3

Documentation

Index

Constants

View Source
const (
	GoDandelionConnChange = "go_dandelion_conn_change"
)

Variables

This section is empty.

Functions

func AppDBChange

func AppDBChange(appKey string, changeType dgorm.ChangeType) error

AppDBChange 用于上报应用数据库发生变更。 如中心服务器修改应用数据库,则需要上报,运 营服务订阅到消息后,自动刷新应用数据库连接 依赖于redis

func HttpServer

func HttpServer() *http.HttpServer

func Init

func Init()

func InitAppDB

func InitAppDB(configFunc dgorm.AppConfigFunc, changeFunc dgorm.AppChangeFunc)

InitAppDB 初始化应用数据库 configFunc 定义获取相关应用数据库连接方法。用于在应 用数据库连接发生变更行为时,各服务自动获取最新的数据 库连接,不用额外进行重连刷新操作

changeFunc 定义相关数据库变更时,业务需要执行的方法 发生变更时,进行回调处理。如,增加新的应用,服务需要 创建表单等操作

func Plugs

func Plugs(plugins ...Plugin) error

func RegisterHeaderFunc

func RegisterHeaderFunc(f func(ctx *routing.Context, header map[string]string) map[string]string)

func RegisterRpcPlugin

func RegisterRpcPlugin(plugins ...server.Plugin)

func RpcCall

func RpcCall(ctx *routing.Context, serverName, funcName string, args interface{}, reply interface{}) error

RpcCall rpc请求

func RpcServer

func RpcServer(handler interface{}, auth ...rpcx.AuthFunc)

func SRpcCall

func SRpcCall(ctx *routing.Context, serverName, funcName string, args interface{}, reply interface{}) error

SRpcCall rpc请求拓展

Types

type DB

type DB struct {
}

func (*DB) GetDB

func (*DB) GetDB(appKeys ...string) *gorm.DB

GetDB 获取数据库连接

type Plugin

type Plugin interface {
	// Config 返回需要初始化的配置,建议使用第二层级
	Config() interface{}
	InitPlugin() error
}

type Redis

type Redis struct {
}

func (*Redis) GetRedis

func (r *Redis) GetRedis() *redigo.Client

type RpcClient

type RpcClient struct {
	ClientName string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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