Categorygithub.com/cbwfree/micro-core
module
0.1.5
Repository: https://github.com/cbwfree/micro-core.git
Documentation: pkg.go.dev

# README

micro-core

Example

package main

import (
	"github.com/cbwfree/micro-core/srv"
	"github.com/cbwfree/micro-core/web"
	log "github.com/micro/go-micro/v2/logger"
)

func main() {
	srv.New(
		"admin",
		srv.FlagBasic,
		srv.FlagRedis,
		srv.FlagMongo,
		srv.FlagHttp,
	)

	srv.With(
		srv.WithMongoDB("admin"),
		srv.WithRedisDB(0),
		srv.WithWebServer("admin"),
	)

	srv.Web().With(
		web.WithEnableSession(true),
		web.WithAPIPrefix("/api"),
		web.WithAPIRoutes(
            ...
		),
	)

	// 服务初始化
	srv.Init()

	// 启动服务
	if err := srv.Run(); err != nil {
		log.Fatalf("Run Error: %v", err)
	}
}

# Packages

No description provided by the author
编译版本信息.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
加密处理.
JWT标准中注册的声明 (建议但不强制使用) : iss: jwt签发者 sub: jwt所面向的用户 aud: 接收jwt的一方 exp: jwt的过期时间,这个过期时间必须要大于签发时间 nbf: 定义在什么时间之前,该jwt都是不可用的.
meta 支持的数据类型: string bool int int32 int64 []int []string []int32 []int64 不支持任何浮点数.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
数据验证插件, 详细的tag请查看 @see https://godoc.org/gopkg.in/go-playground/validator.v9 , = 0x2C, | = 0x7C 使用方式:type Data struct { Value1 `validate:"required"` Value2 `validate:"-"`} 常用 Tag 如下 - 跳过验证 | Or操作符 dive 深入子级数据验证 [][]string with validation tag "gt=0,dive,len=1,dive,required" gt=0 will be applied to [] len=1 will be applied to []string required will be applied to string omitempty 允许空, Usage: omitempty required 必须, Usage: required len 长度, Usage: len=10, 数字验证等于给定的值, 字符串验证长度, 数组验证元素数量 max 最大值, Usage: max=10, 同上 min 最小值, Usage: min=10, 同上 eq 等于, Usage: eq=10 ne 不等于, Usage: ne=10 oneof 枚举, Usage: oneof=1 2 3 gt 大于, Usage: gt=10 gte 大于等于, Usage: gte=10 lt 小于, Usage: lt=10 lte 小于等于, Usage: lte=10 eqfield 等于指定字段值, Usage: eqfield=password nefield 不等于指定字段值, Usage: nefield=username unique For arrays & slices, unique will ensure that there are no duplicates.