core

package
v0.0.0-...-cc3858d Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 23 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 全局默认,用户层pb消息解码
	MsgUnmarshaler = proto.UnmarshalOptions{
		Merge:          false,
		AllowPartial:   true,
		DiscardUnknown: false,
		RecursionLimit: 100,
		NoLazyDecoding: true,
	}
	// 全局默认,用户层pb消息编码
	MsgMarshaler = proto.MarshalOptions{
		AllowPartial:  true,
		Deterministic: false,
	}
)

Functions

func InitHttpApiModule

func InitHttpApiModule(name string, conf *config.HttpApiConfig, makeMsg httpapi.MakeMessageHandler, middlewares []gin.HandlerFunc) error

func InitMongo

func InitMongo(uri string, initOptions ...MongoInitOption) error

func InitRedis

func InitRedis(conf *config.RedisConfig) (err error)

func InitRpcModule

func InitRpcModule(name string, handlerFunc rpc.RpcHandler, conf *config.RpcConfig) error

func RpcHandlerFunc

func RpcHandlerFunc(rc *rpc.RpcContext)

默认RpcHandler

Types

type HttpApiModule

type HttpApiModule struct {
	// contains filtered or unexported fields
}
var HttpApi *HttpApiModule

func (*HttpApiModule) Destroy

func (s *HttpApiModule) Destroy()

func (*HttpApiModule) Name

func (s *HttpApiModule) Name() string

func (*HttpApiModule) OnInit

func (s *HttpApiModule) OnInit() error

func (*HttpApiModule) Run

func (s *HttpApiModule) Run()

type MongoImpl

type MongoImpl struct {
	// contains filtered or unexported fields
}
var Mongo *MongoImpl

func (*MongoImpl) Client

func (m *MongoImpl) Client() *mongo.Client

func (*MongoImpl) GetActiveConnections

func (m *MongoImpl) GetActiveConnections() int

func (*MongoImpl) ReadClient

func (m *MongoImpl) ReadClient() *mongo.Client

func (*MongoImpl) WriteClient

func (m *MongoImpl) WriteClient() *mongo.Client

type MongoInitOption

type MongoInitOption struct {
	ReadPref     *readpref.ReadPref
	MinPoolSize  uint64
	MaxPoolSize  uint64
	ConnIdleTime time.Duration
}

type RpcModule

type RpcModule struct {
	// contains filtered or unexported fields
}
var (
	Rpc *RpcModule
)

func (*RpcModule) AsyncCallWithoutResp

func (m *RpcModule) AsyncCallWithoutResp(serviceName string, req proto.Message, md ...*rpc.Meta) (err error)

func (*RpcModule) Call

func (m *RpcModule) Call(serviceName string, cb rpc.RPCReq) (proto.Message, error)

func (*RpcModule) Destroy

func (m *RpcModule) Destroy()

func (*RpcModule) Name

func (m *RpcModule) Name() string

func (*RpcModule) OnInit

func (m *RpcModule) OnInit() error

func (*RpcModule) RegisterService

func (m *RpcModule) RegisterService(serviceName string, cb func(rpcSrv rpc.ServiceRegistrar, nodeName string) error) error

func (*RpcModule) RegisterServiceOnlyOne

func (m *RpcModule) RegisterServiceOnlyOne(serviceName string, cb func(rpcSrv rpc.ServiceRegistrar, nodeName string) error) error

func (*RpcModule) Run

func (m *RpcModule) Run()

func (*RpcModule) SyncCall

func (m *RpcModule) SyncCall(serviceName string, req, resp proto.Message, timeout time.Duration, md ...*rpc.Meta) (err error)

func (*RpcModule) UnregisterService

func (m *RpcModule) UnregisterService(serviceName string) error

Jump to

Keyboard shortcuts

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