easy

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP_STATUS = "EASY_STATUS"
)

Variables

This section is empty.

Functions

func Covert

func Covert(handler interface{}) gin.HandlerFunc

Covert 将handler转换为Responder

func DBMap

func DBMap(columns []string, rows *sql.Rows) ([]interface{}, error)

func Error

func Error(err error, msg ...string)

func ErrorHandle

func ErrorHandle() gin.HandlerFunc

func ExecExpr

func ExecExpr(expr Expr, data map[string]interface{}) (string, error)

ExecExpr 执行表达式,使用模板引擎 临时方法后期需要修改

func Task

func Task(f TaskFunc, cb func(), params ...interface{})

func Throw

func Throw(err string, code int, context *gin.Context)

Types

type Bean

type Bean interface {
	Name() string
}

type Easy

type Easy struct {
	*gin.Engine
	// contains filtered or unexported fields
}

func Ignite

func Ignite(ginMiddlewares ...gin.HandlerFunc) *Easy

Ignite Easy构造函数

func (*Easy) AfterLaunch added in v0.2.3

func (this *Easy) AfterLaunch(exprs ...interface{})

AfterLaunch 启动之后执行的方法

func (*Easy) Attach

func (this *Easy) Attach(f ...Fairing) *Easy

Attach 添加中间件

func (*Easy) Beans

func (this *Easy) Beans(beans ...Bean) *Easy

Beans 设定数据库连接对象

func (*Easy) Config

func (this *Easy) Config(cfgs ...interface{}) *Easy

func (*Easy) Handle

func (this *Easy) Handle(httpMethod, relativePath string, handler interface{}) *Easy

Handle 重载gin.Handle方法

func (*Easy) Launch

func (this *Easy) Launch(port int32, funcs ...interface{})

Launch 启动

func (*Easy) Mount

func (this *Easy) Mount(group string, classes ...IClass) *Easy

Mount 挂载

func (*Easy) Task

func (this *Easy) Task(cron string, expr interface{}) *Easy

Task 定时任务

type EasyTree

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

func NewEasyTree

func NewEasyTree() *EasyTree

type Expr

type Expr string //表达式类型

type Fairing

type Fairing interface {
	OnRequest(context *gin.Context) error
	OnResponse(ret interface{}) (interface{}, error)
}

Fairing 规范中间件代码和功能的接口

type FairingHandler

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

func NewFairingHandler

func NewFairingHandler() *FairingHandler

func (*FairingHandler) AddFairing

func (this *FairingHandler) AddFairing(f ...Fairing)

type GPA

type GPA interface {
	DB() *sql.DB
}

type GPAUtil

type GPAUtil struct {
	GDB GPA `inject:"-"`
}

func NewGPAUtil

func NewGPAUtil() *GPAUtil

type IClass

type IClass interface {
	Build(easy *Easy)
	Name() string
}

type Json

type Json interface{}

type JsonResponder

type JsonResponder func(*gin.Context) Json

JsonResponder json数据处理

func (JsonResponder) RespondTo

func (this JsonResponder) RespondTo() gin.HandlerFunc

type Model

type Model interface {
	String() string
}

type Models

type Models string

func MakeModels

func MakeModels(v interface{}) Models

type Param

type Param struct {
	Key   string
	Value string
}

Param is a single URL parameter, consisting of a key and a value.

type Params

type Params []Param

Params is a Param-slice, as returned by the router. The slice is ordered, the first URL parameter is also the first slice value. It is therefore safe to read values by the index.

func (Params) ByName

func (ps Params) ByName(name string) (va string)

ByName returns the value of the first Param which key matches the given name. If no matching Param is found, an empty string is returned.

func (Params) Get

func (ps Params) Get(name string) (string, bool)

Get returns the value of the first Param which key matches the given name. If no matching Param is found, an empty string is returned.

type Query

type Query interface {
	Sql() string
	Args() []interface{}
	Mapping() map[string]string
	First() bool
	Key() string
	Get() interface{}
}

type Responder

type Responder interface {
	RespondTo() gin.HandlerFunc
}

type RouteInfo

type RouteInfo struct {
	Method      string
	Path        string
	Handler     string
	HandlerFunc interface{}
}

type RoutesInfo

type RoutesInfo []RouteInfo

type SimpleQuery

type SimpleQuery string

func (SimpleQuery) Args

func (this SimpleQuery) Args() []interface{}

func (SimpleQuery) First

func (this SimpleQuery) First() bool

func (SimpleQuery) Get

func (this SimpleQuery) Get() interface{}

func (SimpleQuery) Key

func (this SimpleQuery) Key() string

func (SimpleQuery) Mapping

func (this SimpleQuery) Mapping() map[string]string

func (SimpleQuery) Sql

func (this SimpleQuery) Sql() string

func (SimpleQuery) WithArgs

func (this SimpleQuery) WithArgs(args ...interface{}) *SimpleQueryWithArgs

func (SimpleQuery) WithFirst

func (this SimpleQuery) WithFirst() *SimpleQueryWithArgs

func (SimpleQuery) WithKey

func (this SimpleQuery) WithKey(key string) *SimpleQueryWithArgs

func (SimpleQuery) WithMapping

func (this SimpleQuery) WithMapping(mapping map[string]string) *SimpleQueryWithArgs

type SimpleQueryWithArgs

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

func NewSimpleQueryWithArgs

func NewSimpleQueryWithArgs(sql string, args []interface{}) *SimpleQueryWithArgs

func NewSimpleQueryWithFetchFirst

func NewSimpleQueryWithFetchFirst(sql string) *SimpleQueryWithArgs

func NewSimpleQueryWithKey

func NewSimpleQueryWithKey(sql string, key string) *SimpleQueryWithArgs

func NewSimpleQueryWithMapping

func NewSimpleQueryWithMapping(sql string, mapping map[string]string) *SimpleQueryWithArgs

func (*SimpleQueryWithArgs) Args

func (this *SimpleQueryWithArgs) Args() []interface{}

func (*SimpleQueryWithArgs) First

func (this *SimpleQueryWithArgs) First() bool

func (*SimpleQueryWithArgs) Get

func (this *SimpleQueryWithArgs) Get() interface{}

func (*SimpleQueryWithArgs) Key

func (this *SimpleQueryWithArgs) Key() string

func (*SimpleQueryWithArgs) Mapping

func (this *SimpleQueryWithArgs) Mapping() map[string]string

func (*SimpleQueryWithArgs) Sql

func (this *SimpleQueryWithArgs) Sql() string

func (*SimpleQueryWithArgs) WithFirst

func (this *SimpleQueryWithArgs) WithFirst() *SimpleQueryWithArgs

func (*SimpleQueryWithArgs) WithKey

func (this *SimpleQueryWithArgs) WithKey(key string) *SimpleQueryWithArgs

func (*SimpleQueryWithArgs) WithMapping

func (this *SimpleQueryWithArgs) WithMapping(mapping map[string]string) *SimpleQueryWithArgs

type SqlQueryResponder

type SqlQueryResponder func(*gin.Context) Query

func (SqlQueryResponder) RespondTo

func (this SqlQueryResponder) RespondTo() gin.HandlerFunc

type SqlResponder

type SqlResponder func(*gin.Context) SimpleQuery

func (SqlResponder) RespondTo

func (this SqlResponder) RespondTo() gin.HandlerFunc

type StringResponder

type StringResponder func(*gin.Context) string

StringResponder 字符串处理

func (StringResponder) RespondTo

func (this StringResponder) RespondTo() gin.HandlerFunc

type TaskExecutor

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

TaskExecutor 任务执行者

func NewTaskExecutor

func NewTaskExecutor(f TaskFunc, p []interface{}, callback func()) *TaskExecutor

func (*TaskExecutor) Exec

func (this *TaskExecutor) Exec()

Exec 执行任务

type TaskFunc

type TaskFunc func(params ...interface{})

TaskFunc 任务函数类型

type View deprecated

type View string

Deprecated: 暂时不提供View的解析

type ViewResponder

type ViewResponder func(*gin.Context) View

func (ViewResponder) RespondTo

func (this ViewResponder) RespondTo() gin.HandlerFunc

type Void

type Void struct{}

type VoidResponder

type VoidResponder func(ctx *gin.Context) Void

func (VoidResponder) RespondTo

func (this VoidResponder) RespondTo() gin.HandlerFunc

Jump to

Keyboard shortcuts

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