frame

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResponseTypeJson = 1
	ResponseTypeXml  = 3
	CodeSuccess      = 0
)

Variables

View Source
var Config conf
View Source
var DB *gorm.DB
View Source
var ErrLevel = map[ErrorLevel]string{
	LogLevelInfo:  "info",
	LogLevelError: "error",
}

Functions

func Listening

func Listening(app *iris.Application)

Listening 开始监听端口

func Load

func Load(app *iris.Application, configPath string)

func LoadConf

func LoadConf(path ...string)

LoadConf 读取Yaml配置文件

func LoadMysql added in v0.8.0

func LoadMysql()

func LoadRedis added in v0.8.0

func LoadRedis()

func LogError added in v0.2.0

func LogError(msg string, data interface{})

func LogInfo added in v0.2.0

func LogInfo(msg string, data interface{})

func MySqlDefault

func MySqlDefault() *gorm.DB

func NewRedisConn

func NewRedisConn(conn *redis.Client) *redisConn

func RedisConn

func RedisConn() *redisConn

func RedisDefault

func RedisDefault() *redis.Client

Types

type Api

type Api struct {
	Method     string
	Name       string
	Login      bool
	AuthKey    string
	Controller func(base *Base) ApiInterface
}

type ApiInterface

type ApiInterface interface {
	Handler() int
}

type App

type App struct {
	AppName string `yaml:"appName"`
	CnName  string `yaml:"cnName"`
	Port    string `yaml:"port"`
	SysCode uint32 `yaml:"sysCode"`
	TLS     string `yaml:"tls"`
}

type Base

type Base struct {
	Method string `json:"-"`
	Path   string `json:"-"`

	Time      time.Time `json:"-"`
	TimeStamp int64     `json:"-"`

	// 参数签名
	RandomStr string `valid:"length(32|32)"`
	SignAt    int64  `valid:"timestamp"`
	Sign      string `valid:"-"`
	// contains filtered or unexported fields
}

func NewBase

func NewBase(ctx iris.Context) *Base

func (*Base) CancelMustJsonParam

func (this *Base) CancelMustJsonParam()

func (*Base) CryptReceive

func (this *Base) CryptReceive() []byte

CryptReceive 加密:后端--->前端

func (*Base) CryptSend

func (this *Base) CryptSend(data []byte)

CryptSend 加密:后端--->前端

func (*Base) Ctx

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

func (*Base) DB

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

DB 默认

func (*Base) Init

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

func (*Base) InitAndBackParam

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

InitAndBackParam Init返回前端传回的参数

func (*Base) Key

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

Key 从header中获取前端公钥

func (*Base) MyId

func (this *Base) MyId() uint32

func (*Base) MyIdToString added in v0.9.5

func (this *Base) MyIdToString() string

func (*Base) Page

func (this *Base) Page() int64

func (*Base) PageSize

func (this *Base) PageSize() int64

func (*Base) Redis

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

func (*Base) ReplaceParamColumn

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

func (*Base) SetMyId added in v0.9.5

func (this *Base) SetMyId(id uint32)

func (*Base) Skip

func (this *Base) Skip() int64

func (*Base) Success

func (this *Base) Success()

func (*Base) SuccessWithData

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

func (*Base) SuccessWithList

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

func (*Base) Token

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

func (*Base) ValidateParam

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

ValidateParam 参数校验

type DbInfo added in v0.9.2

type DbInfo struct {
	Host            string `yaml:"host"`
	Port            string `yaml:"port"`
	Database        string `yaml:"database"`
	UserName        string `yaml:"username"`
	Password        string `yaml:"password"`
	MaxIdleConn     int    `yaml:"maxIdleConn"`
	MaxOpenConn     int    `yaml:"maxOpenConn"`
	ConnMaxIdleTime int    `yaml:"connMaxIdleTime"`
	ConnMaxLifetime int    `yaml:"connMaxLifetime"`
}

type ErrorLevel added in v0.2.0

type ErrorLevel int
const (
	LogLevelInfo ErrorLevel = 1 + iota
	LogLevelError
	LogDriverConsole
	LogDriverLocal
	LogDriverServer
)

type Message

type Message struct {
	AccessKeyId     string
	AccessKeySecret string
}

type Microservices added in v0.7.0

type Microservices struct {
	FileAddr string `yaml:"fileAddr"`
	RPCAddr  string `yaml:"rpcAddr"`
}

type Redis

type Redis struct {
	Host        string `yaml:"host"`
	Port        string `yaml:"port"`
	Db          int    `yaml:"db"`
	Password    string `yaml:"password"`
	PoolSize    int    `yaml:"poolSize"`
	MinIdleConn int    `yaml:"MinIdleConn"`
}

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 SysConfig

type SysConfig struct {
	// 定时器
	StartSchedule    bool   `yaml:"startSchedule"`
	LogLevel         string `yaml:"logLevel"`
	ValidatorService bool   `yaml:"validatorService"`
	UserDefault      bool   `yaml:"userDefault"`
	GenerateRSAKey   bool   `yaml:"generateRSAKey"`
}

SysConfig 系统配置

type UpBase

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

type Wechat

type Wechat struct {
	AppID string `yaml:"appID"`
}

Jump to

Keyboard shortcuts

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