grpc

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

盘古 Golang应用程序框架

编译状态 Golang质量 版本 仓库大小 最后提交 授权协议 语言个数 最佳语言 星星个数

一个Golang应用程序快速开发框架,有以下特性

  • 快速开发
  • 内置配置文件加载
    • Yaml
    • Toml
    • Json
    • XML
    • 很方便定制自己的配置文件加载器
  • 内置强大的数据验证
    • 内置强大的且非常多的数据验证器
    • 很方便的定制自己的数据验证器
  • 强大的扩展功能
  • 强大的配置功能
    • 徽标
    • 帮助信息
    • 命令行
    • 一切可配置点皆可配置
  • 线程安全
  • 内置依赖注入
  • 语义化
    • 方便使用
    • 多态行为,同一个调用在不同的场景下有不同的意义

快速开始

Pangu使用非常简单,只需要定义两部分代码启动方法和启动器以及依赖关系,对于依赖关系

  • 可以没有依赖,如果没有,就不需要处理依赖
  • 一般稍微大型一点的系统都会有复杂的依赖关系,而这正是盘古框架的强项
  • 对于没有依赖或者依赖非常少的项目,使用盘古反而会使代码变多,这个需要大家酌情考虑

启动方法代码如下

package main

import (
    `github.com/pangum/pangu`
    `github.com/pangum/pangum`
)

func main() {
    panic(pangu.New(
        pangu.Named(`ziyunix`),
        pangu.Banner(`Ziyunix Server`, pangu.BannerTypeAscii),
    ).Run(newBootstrap))
}

启动器的代码如下

package main

type bootstrap struct {
    application *pangu.Application
}

func newBootstrap(application *pangu.Application) pangu.Bootstrap {
    return &bootstrap{
        application: application,
    }
}

依赖关系建议像如下处理

package rest

import (
	`github.com/pangum/pangu`
)

type Server struct {}

func newServer(/* 如果有依赖,可以在这里增加依赖:api *Api */) *Server {
	return new(Server)
}

func init() {
	pangu.New().Dependencies(
		newServer,
		// 其它依赖
		// ...
	)
}

Pangu有非常多的配置项,请参看使用文档

文档

点击这里查看最新文档

使用示例

点击这里查看最新的代码示例

项目实践

交流

微信群

捐助

支持宝 微信

感谢Jetbrains

本项目通过Jetbrains开源许可IDE编写源代码,特此感谢 Jetbrains图标

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStub added in v0.0.6

func NewStub[T any](fun func(grpc.ServiceRegistrar, T), server T) kernel.Stub

Types

type Client

type Client = core.Client

Client 客户端

type Gateway

type Gateway = core.Gateway

Gateway 网关

type Handler

type Handler = kernel.Handler

Handler 注册方法

type Server

type Server = core.Server

Server 服务器

type Stub added in v0.0.6

type Stub = kernel.Stub

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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