zrpc

package module
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: MIT Imports: 7 Imported by: 0

README

   go get github.com/zusux/zrpc

初始化

配置文件

// 配置文件存放路径 默认在 执行目录/config/prod.yaml
//设置配置文件路径
//初始化
zrpc.Init()

log 获取

log := zrpc.Log()

配置项获取

conf := zrpc.GetConf()
name := zrpc.K.String("server.name")

gorm 获取

   gorm  := zrpc.GetDb()

redis 获取

redis := zrpc.Redis() ####grpc 服务注册

    conf := zrpc.GetConf()
    conf.Register()
    conf.GrpcRequestRemote(ctx context.Context,serverName string, req interface{}, reqFactory sd.Factory)
    conf.UnRegister()

Documentation

Index

Constants

This section is empty.

Variables

Functions

func GetConf

func GetConf() *internal.Server

func GetDb

func GetDb() *gorm.DB

GetDb 系统默认Db

func Init

func Init()

func InitConfig added in v1.0.0

func InitConfig() *internal.Server

func Log added in v1.0.0

func Log() *logrus.Logger

Log 获取日志

func NewDb added in v1.0.3

func NewDb(section string) (*gorm.DB, error)

NewDb 获取指定Db

func NewError added in v1.0.0

func NewError(code int, message string) *internal.Error

func NewLog added in v1.0.0

func NewLog(section string) *logrus.Logger

NewLog 获取日志

func Redis added in v1.0.0

func Redis() *redis.Client

Redis redis

Types

This section is empty.

Directories

Path Synopsis
ssl

Jump to

Keyboard shortcuts

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