v2

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: Apache-2.0 Imports: 11 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

This section is empty.

Variables

This section is empty.

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 CreateCron added in v0.0.6

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

CreateCron 创建定时任务

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 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 Start

func Start(address, agent, sqlHost, sqlPort, sqlRoot, sqlPass, baseName string, maxSessionTime time.Duration, isLogRouter 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) 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 PageSize

type PageSize struct {
	CurrentPage int         `json:"current_page"`
	Data        interface{} `json:"data"`
	LastPage    int         `json:"last_page"`
	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