v2

package module
v1.0.53 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

README

Copyright 2021 black1552

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Index

Constants

View Source
const BaseConfig = `` /* 1267-byte string literal not displayed */

Variables

View Source
var ConfigPath = gfile.Pwd() + "/manifest/config/config.yaml"

Functions

func AuthAdmin

func AuthAdmin(r *ghttp.Request)

func AuthBase

func AuthBase(r *ghttp.Request, name string)

AuthBase 鉴权中间件,只有前端或者后端登录成功之后才能通过

func AuthIndex

func AuthIndex(r *ghttp.Request)

func Compress added in v1.0.10

func Compress(filePath string) string

func ConfigInit added in v1.0.32

func ConfigInit()

func CreateCron added in v0.0.6

func CreateCron(ctx context.Context, time string, name string, operate func())

CreateCron 创建定时任务

func CreateDB added in v0.1.0

func CreateDB(ctx context.Context, sqlHost, sqlPort, sqlRoot, sqlPass, baseName string, debug bool)

func CreateFileDir added in v1.0.10

func CreateFileDir() error

func GetCapitalPass added in v0.0.6

func GetCapitalPass(val string) string

GetCapitalPass MD5化并转换为大写

func GetResult added in v0.0.6

func GetResult(ctx context.Context, url string, data g.Map, va *gvar.Var) (string, error)

func InStrArray added in v1.0.10

func InStrArray(ext string, code int) bool

func LogDeBug added in v1.0.42

func LogDeBug(content ...interface{})

func LogError added in v1.0.11

func LogError(content ...interface{})

func LogInfo added in v1.0.11

func LogInfo(content ...interface{})

func LoginJson added in v1.0.10

func LoginJson(r *ghttp.Request, msg string, data ...interface{})

func MiddlewareError

func MiddlewareError(r *ghttp.Request)

MiddlewareError 异常处理中间件

func NoLogin

func NoLogin(r *ghttp.Request)

func PostResult added in v0.0.6

func PostResult(ctx context.Context, url string, data g.Map, header string, class string) (string, error)

PostResult 建立POST请求并返回结果

func RemoveCron added in v0.0.6

func RemoveCron(name string)

RemoveCron 停止并删除定时任务

func ResponseJson

func ResponseJson(ctx context.Context, data interface{})

func SearchCron added in v1.0.10

func SearchCron(name string) *gcron.Entry

SearchCron 查询定时任务运行状态 如果定时任务未运行则返回NIL 运行则返回运行状态

func Sha256 added in v1.0.43

func Sha256(src string) string

func Start

func Start(agent string, maxSessionTime time.Duration, isApi bool, maxBody ...int64) *ghttp.Server

func StartCrons added in v0.0.6

func StartCrons(name string)

StartCrons 开始指定的定时任

func StopCron added in v0.0.6

func StopCron(name string)

StopCron 紧停止指定定时任务

func Transaction added in v0.0.6

func Transaction(function func() error)

Transaction 简单封装事务操作

Types

type ApiRes

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

func Error

func Error(ctx context.Context) *ApiRes

func Success

func Success(ctx context.Context) *ApiRes

func (*ApiRes) End

func (a *ApiRes) End()

func (*ApiRes) FileDownload added in v1.0.17

func (a *ApiRes) FileDownload(path, name string)

func (*ApiRes) FileSelect added in v1.0.17

func (a *ApiRes) FileSelect(path string)

func (*ApiRes) SetCode

func (a *ApiRes) SetCode(code int) *ApiRes

func (*ApiRes) SetData

func (a *ApiRes) SetData(data interface{}) *ApiRes

func (*ApiRes) SetMsg

func (a *ApiRes) SetMsg(msg string) *ApiRes

type Json

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

type Logs added in v1.0.21

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

type PageSize

type PageSize struct {
	CurrentPage int         `json:"currentPage"`
	Data        interface{} `json:"data"`
	LastPage    int         `json:"lastPage"`
	PerPage     int         `json:"per_page"`
	Total       int         `json:"total"`
}

func SetPage

func SetPage(page, limit, total int, data interface{}) *PageSize

SetPage 设置分页

Jump to

Keyboard shortcuts

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