neon

package module
v0.0.0-...-41aba7b Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 9 Imported by: 0

README

neon

Go Report Card

系统架构

名词解释
  • System

    指一组使用同一套存储的、功能边界明确的、分层的(BFF/Service)一组微服务提供的系统

  • BFF(Backend for Frontend)

    为客户端提供HTTP接口组装的服务层

  • Service

    对后端其他service/bff提供Rpc接口的服务,服务本身不对外暴露

neon

neon是一套使用本架构开发理念的基础开发套件、该库作为其他BFF/Service开发的基础依赖库,使用该库可以减少业务服务的开发负担

目录结构
+ neon
  + bff     //bff层服务基础库
  + config  //配置文件处理
  + doc     //文档
  + errors  //带StackTrace的错误处理
  + logger  //统一log处理
  + plugin  //插件
  	+ db
  	+ es
  	+ metrics
  	+ redis
  	+ rpc
  + service //rpc层服务基础库
  + utils   //工具型类库
  	+ validator //参数校验依赖库

开发前准备

安装命令行工具
go get github.com/geekymedic/neon-cli

或者手动下载二进制包: neon-cli

IDE插件支持

Doc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPlugin

func AddPlugin(name string, handler PluginHandler)

func LoadPlugins

func LoadPlugins(viper *viper.Viper) error

func SetSession

func SetSession(session *Session, ctx *gin.Context)

Types

type PluginHandler

type PluginHandler func(status PluginStatus, viper *viper.Viper) error

type PluginStatus

type PluginStatus int
const (
	PluginLoad PluginStatus = 1
)

type Session

type Session struct {
	Uid         string
	Token       string
	Platform    string
	Version     string
	Net         string
	Mobile      string
	OS          string
	Device      string
	Describe    string
	Trace       string
	Sequence    string
	Time        string
	StoreId     string
	Path        string
	ClientIp    string
	StructError string
}

func CreateSessionFromGrpcIncomingContext

func CreateSessionFromGrpcIncomingContext(ctx context.Context) *Session

func CreateSessionFromGrpcOutgoingContext

func CreateSessionFromGrpcOutgoingContext(ctx context.Context) *Session

func NewSessionFromGinCtx

func NewSessionFromGinCtx(ctx *gin.Context) *Session

func (*Session) Keys

func (m *Session) Keys() map[string]*string

func (*Session) KeysValues

func (m *Session) KeysValues() map[string]string

func (*Session) SetRandomTrace

func (m *Session) SetRandomTrace()

func (*Session) ShortLog

func (m *Session) ShortLog() []interface{}

Jump to

Keyboard shortcuts

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