dsg

package module
v2.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 18 Imported by: 0

README

功能

数据库

缓存

  • 默认缓存(非Redis
    • 系统版本
    • RSA秘钥

gRPC

go install google.golang.org/protobuf/cmd/remote-gen-go@v1.26
go install google.golang.org/grpc/cmd/remote-gen-go-grpc@v1.1

Documentation

Overview

Package dsg @Author: asus @Description: $ @File: New @Data: 2022/2/2118:09

Index

Constants

View Source
const (
	CodeSuccess = 0
)

Variables

This section is empty.

Functions

func AESDeCode

func AESDeCode(data []byte) string

func AESEnCode

func AESEnCode(data string) []byte

func CheckIDCard

func CheckIDCard(idCard string) bool

func CheckMobile

func CheckMobile(mobile string) bool

func CreateToken

func CreateToken(UserID uint32, ExpiresAt time.Duration) string

CreateToken 创建Token

func Default

func Default(list ...option)

Default dsg初始化后,可以通过dsg.xxx调用各个子功能

func EnIDCard

func EnIDCard(idCard string) string

func EnMobile

func EnMobile(mobile string) string

func Listening

func Listening(app *iris.Application)

Listening 开始监听端口

func Load

func Load(conf *env.Conf, configPath string)

func Login

func Login(ctx iris.Context)

Login 中间件 login

func MiddlewareJwt

func MiddlewareJwt(ctx iris.Context)

MiddlewareJwt 中间件 login

func OptionAes

func OptionAes(aesKey string) option

func OptionEtcd

func OptionEtcd(conf etcd.Config) func() error

func OptionJwt

func OptionJwt(JwtKey string) func() error

func OptionMysql

func OptionMysql(info mysql.DBInfo) func() error

func OptionRedis

func OptionRedis(config redis.Config) func() error

func ParseToken

func ParseToken(token string) *jwt.MapClaims

ParseToken 解析Token

Types

type Base

type Base struct {
	// contains filtered or unexported fields
}

func NewBase

func NewBase(ctx iris.Context) *Base

func (*Base) Ctx

func (p *Base) Ctx() iris.Context

func (*Base) DB

func (p *Base) DB() *gorm.DB

DB 默认

func (*Base) Init

func (p *Base) Init(data interface{})

func (*Base) InitAndBackParam

func (p *Base) InitAndBackParam(data interface{}) (param map[string]interface{})

InitAndBackParam Init返回前端传回的参数

func (*Base) Key

func (p *Base) Key() (rsa []byte)

Key 从header中获取前端公钥

func (*Base) MyId

func (p *Base) MyId() uint32

func (*Base) MyIdToString

func (p *Base) MyIdToString() string

func (*Base) Page

func (p *Base) Page() int64

func (*Base) PageSize

func (p *Base) PageSize() int64

func (*Base) Redis

func (p *Base) Redis() *redis.Client

func (*Base) ReplaceParamColumn

func (p *Base) ReplaceParamColumn(data, old interface{}, requestParam map[string]interface{}) map[string]interface{}

func (*Base) SetMyId

func (p *Base) SetMyId(id uint32)

func (*Base) Skip

func (p *Base) Skip() int64

func (*Base) Success

func (p *Base) Success()

func (*Base) SuccessWithData

func (p *Base) SuccessWithData(data interface{})

func (*Base) SuccessWithList

func (p *Base) SuccessWithList(list interface{}, total interface{})

func (*Base) Token

func (p *Base) Token() (token string)

func (*Base) ValidateParam

func (p *Base) ValidateParam(data interface{})

ValidateParam 参数校验

type Context

type Context struct {
	Ctx iris.Context
}

func New

func New(ctx iris.Context) *Context

type ResJson

type ResJson struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

type ResSign

type ResSign struct {
	RandomStr string
	SignAt    int64
	Sign      string
}

type Response

type Response struct {
	Code  int
	Msg   string
	Data  interface{}
	List  []interface{}
	Total int
}

type UpBase

type UpBase struct {
	Base
	// contains filtered or unexported fields
}

Directories

Path Synopsis
example
cond
Package cond @Author: asus @Description: $ @File: cond @Data: 2022/4/129:54
Package cond @Author: asus @Description: $ @File: cond @Data: 2022/4/129:54
pkg
aes/ecb_aes
Package ecb_aes @Author: asus @Description: $ @File: aes_decrypt @Data: 2022/8/1917:12
Package ecb_aes @Author: asus @Description: $ @File: aes_decrypt @Data: 2022/8/1917:12
jwt
log
util
Package service @Author: asus @Description: $ @File: random @Data: 2021/12/2318:44
Package service @Author: asus @Description: $ @File: random @Data: 2021/12/2318:44
util/guzzle
Package guzzle @Author: asus @Description: $ @File: client @Data: 2022/1/2016:41
Package guzzle @Author: asus @Description: $ @File: client @Data: 2022/1/2016:41
validator
Package validator @Author: asus @Description: $ @File: registerValidation @Data: 2021/12/311:16
Package validator @Author: asus @Description: $ @File: registerValidation @Data: 2021/12/311:16
zip

Jump to

Keyboard shortcuts

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