collect

package
v0.0.0-...-035e5cb Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const AddOperation = "add"
View Source
const ArrayObjRuleName = "array_obj_value"

ArrayObjRuleName 简单的数组对比,以逗号分割

View Source
const EndName = "end"
View Source
const ModifyOperation = "modify"
View Source
const SimpleArrayRuleName = "simple_array_value"

SimpleArrayRuleName 简单的数组对比,以逗号分割

View Source
const SimpleFieldRuleName = "compare_field_value"

SimpleFieldRuleName 简单的字段比对

View Source
const StartName = "start"

Variables

This section is empty.

Functions

func BaseHandlerNode

func BaseHandlerNode(param *config.HandlerParam, template *config.Template, ts *TemplateService) *common.Result

* * 服务流程化

func ExecTime

func ExecTime(template *collect.Template, start time.Time, method string)

func GetFieldName

func GetFieldName(key string) string

func GetOpName

func GetOpName(key string) string

func HandlerOneParams

func HandlerOneParams(handlerParam *collect.HandlerParam,
	template *collect.Template,
	ts *TemplateService) *common.Result

* 处理handler param 中的节点

func HandlerRequest

func HandlerRequest(c *gin.Context)

func IsPluginEnable

func IsPluginEnable(Tpl *text_template.Template, plugin collect.Plugin) bool

func Ping

func Ping()

func RunScheduleService

func RunScheduleService() []*collect.ServiceConfig

RunScheduleService 添加定时任务

func RunStartupService

func RunStartupService() []*collect.ServiceConfig

RunStartupService 添加启动服务

func SetDatabaseModel

func SetDatabaseModel(m DatabaseModel)

SetDatabaseModel 设置数据库表

func SetOuterModuleRegister

func SetOuterModuleRegister(registerList []ModuleResult)

SetOuterModuleRegister 设置外部处理器

func SetRegisterList

func SetRegisterList(t *config.RouterAll, registerList []ModuleResult)

Types

type AfterLoader

type AfterLoader struct {
}

func (*AfterLoader) HandlerCache

func (t *AfterLoader) HandlerCache(config collect.Plugin, template *collect.Template, routerAll *collect.RouterAll, ts *TemplateService) *common.Result

func (*AfterLoader) ResultHandler

func (t *AfterLoader) ResultHandler(config collect.Plugin, template *collect.Template, routerAll *collect.RouterAll, ts *TemplateService) *common.Result

type Arr2Dict

type Arr2Dict struct {
	BaseHandler
}

func (*Arr2Dict) HandlerData

func (ao *Arr2Dict) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type Arr2Obj

type Arr2Obj struct {
	BaseHandler
}

func (*Arr2Obj) HandlerData

func (ao *Arr2Obj) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type Arr2arrayObj

type Arr2arrayObj struct {
	BaseHandler
}

func (*Arr2arrayObj) HandlerData

func (uf *Arr2arrayObj) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type ArrayObjRule

type ArrayObjRule struct {
	BaseRule
}

func (*ArrayObjRule) Handler

func (s *ArrayObjRule) Handler() ([]map[string]interface{}, bool)

type BaseFlow

type BaseFlow struct {
}

func (*BaseFlow) Flow

func (s *BaseFlow) Flow(template *config.Template, ts *TemplateService, handlerNode func(param *config.HandlerParam, template *config.Template, ts *TemplateService) *common.Result) *common.Result

type BaseHandler

type BaseHandler struct {
}

func (*BaseHandler) CheckFilter

func (s *BaseHandler) CheckFilter(template *config.Template, model interface{}) *common.Result

func (*BaseHandler) GetDatasource

func (s *BaseHandler) GetDatasource() (*sql.DB, error)

GetDatasource 获取数据库连接

func (*BaseHandler) GetFieldNames

func (s *BaseHandler) GetFieldNames(handlerParam *config.HandlerParam) []string

func (*BaseHandler) GetGormDb

func (s *BaseHandler) GetGormDb() *gorm.DB

func (*BaseHandler) GetOtherDatasource

func (s *BaseHandler) GetOtherDatasource(name string) (*sql.DB, error)

func (*BaseHandler) HandlerData

func (s *BaseHandler) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

func (*BaseHandler) HandlerFilter

func (s *BaseHandler) HandlerFilter(template *config.Template) (interface{}, []interface{})

func (*BaseHandler) Result

func (s *BaseHandler) Result(template *config.Template, ts *TemplateService) *common.Result

func (*BaseHandler) RunFuncName

func (s *BaseHandler) RunFuncName() string

func (*BaseHandler) UpdateFields

func (s *BaseHandler) UpdateFields(params map[string]interface{}, modelData interface{}, ignoreFields []string, updateFields []string, optionFields []string) (interface{}, []string)

UpdateFields 更新字段,model_update 更新用的

func (*BaseHandler) UpdateFieldsToMap

func (s *BaseHandler) UpdateFieldsToMap(params map[string]interface{}, modelData interface{}, ignoreFields []string, updateFields []string, optionFields []string) (map[string]interface{}, []string)

func (*BaseHandler) UpdateFieldsToMapList

func (s *BaseHandler) UpdateFieldsToMapList(models []map[string]interface{}, modelData interface{}, template *config.Template, ts *TemplateService) ([]map[string]interface{}, []string, string)

UpdateFieldsToMapList 批量更新字段,批量创建和批量修改用的

type BaseRequestHandler

type BaseRequestHandler struct {
	RequestHandler
	// contains filtered or unexported fields
}

func (*BaseRequestHandler) Close

func (t *BaseRequestHandler) Close()

func (*BaseRequestHandler) CreateRequest

func (t *BaseRequestHandler) CreateRequest() *common.Result

CreateRequest 处理请求

func (*BaseRequestHandler) GetBody

func (t *BaseRequestHandler) GetBody() io.Reader

func (*BaseRequestHandler) GetConfig

func (t *BaseRequestHandler) GetConfig() *config.HttpConfig

func (*BaseRequestHandler) GetData

func (t *BaseRequestHandler) GetData() interface{}

func (*BaseRequestHandler) GetDataStr

func (t *BaseRequestHandler) GetDataStr() string

func (*BaseRequestHandler) GetLogData

func (t *BaseRequestHandler) GetLogData() map[string]interface{}

func (*BaseRequestHandler) GetMethod

func (t *BaseRequestHandler) GetMethod() string

func (*BaseRequestHandler) GetParams

func (t *BaseRequestHandler) GetParams() map[string]interface{}

func (*BaseRequestHandler) GetResult

func (t *BaseRequestHandler) GetResult() *common.Result

func (*BaseRequestHandler) GetUrl

func (t *BaseRequestHandler) GetUrl() string

func (*BaseRequestHandler) HandlerRequest

func (t *BaseRequestHandler) HandlerRequest() *common.Result

HandlerRequest 处理请求

func (*BaseRequestHandler) SetBody

func (t *BaseRequestHandler) SetBody(body io.Reader)

func (*BaseRequestHandler) SetConfig

func (t *BaseRequestHandler) SetConfig(config *config.HttpConfig)

func (*BaseRequestHandler) SetData

func (t *BaseRequestHandler) SetData(data interface{})

func (*BaseRequestHandler) SetParams

func (t *BaseRequestHandler) SetParams(params map[string]interface{})

func (*BaseRequestHandler) SetUrl

func (t *BaseRequestHandler) SetUrl(url string)

type BaseRule

type BaseRule struct {
	Field           config.HandlerParam
	OpFieldTransfer map[string]string
	Template        *config.Template
	Ts              *TemplateService
	HandlerData
}

func (*BaseRule) GetAfterName

func (s *BaseRule) GetAfterName() string

func (*BaseRule) GetBeforeName

func (s *BaseRule) GetBeforeName() string

func (*BaseRule) GetField

func (s *BaseRule) GetField() string

func (*BaseRule) GetFieldName

func (s *BaseRule) GetFieldName() string

func (*BaseRule) GetLeftField

func (s *BaseRule) GetLeftField() string

func (*BaseRule) GetLeftValueField

func (s *BaseRule) GetLeftValueField() string

func (*BaseRule) GetName

func (s *BaseRule) GetName() string

func (*BaseRule) GetOperationName

func (s *BaseRule) GetOperationName() string

func (*BaseRule) GetRightField

func (s *BaseRule) GetRightField() string

func (*BaseRule) GetRightValueField

func (s *BaseRule) GetRightValueField() string

func (*BaseRule) GetTransferName

func (s *BaseRule) GetTransferName(original string) string

GetTransferName 转换字段名称

func (*BaseRule) GetValueName

func (s *BaseRule) GetValueName() string

func (*BaseRule) Handler

func (s *BaseRule) Handler()

func (*BaseRule) LeftObj

func (s *BaseRule) LeftObj() map[string]interface{}

func (*BaseRule) LeftObjArr

func (s *BaseRule) LeftObjArr() []map[string]interface{}

func (*BaseRule) RightObj

func (s *BaseRule) RightObj() map[string]interface{}

func (*BaseRule) RightObjArr

func (s *BaseRule) RightObjArr() []map[string]interface{}

func (*BaseRule) Transfer

func (s *BaseRule) Transfer(dataList []map[string]interface{}) []map[string]interface{}

type BeforeLoader

type BeforeLoader struct {
}

* * 请求前处理参数

func (*BeforeLoader) HandlerCache

func (t *BeforeLoader) HandlerCache(config collect.Plugin, template *collect.Template, routerAll *collect.RouterAll, ts *TemplateService) *common.Result

func (*BeforeLoader) HandlerParams

func (t *BeforeLoader) HandlerParams(config collect.Plugin, template *collect.Template, routerAll *collect.RouterAll, ts *TemplateService) *common.Result

* * 处理参数

func (*BeforeLoader) HandlerReqParam

func (t *BeforeLoader) HandlerReqParam(config collect.Plugin, template *collect.Template, routerAll *collect.RouterAll, ts *TemplateService) *common.Result

func (*BeforeLoader) PreventDuplication

func (t *BeforeLoader) PreventDuplication(config collect.Plugin, template *collect.Template, routerAll *collect.RouterAll, ts *TemplateService) *common.Result

防止重复请求

type BulkCreateService

type BulkCreateService struct {
	BaseHandler
}

func (*BulkCreateService) Result

func (s *BulkCreateService) Result(template *config.Template, ts *TemplateService) *common.Result

type BulkService

type BulkService struct {
	BaseHandler
}

func (*BulkService) Result

func (s *BulkService) Result(template *config.Template, ts *TemplateService) *common.Result

type BulkUpsertService

type BulkUpsertService struct {
	BaseHandler
}

func (*BulkUpsertService) Result

func (s *BulkUpsertService) Result(template *config.Template, ts *TemplateService) *common.Result

type ChangeData

type ChangeData struct {
	Before        interface{}
	BeforeDataMap map[string]interface{}
	After         interface{}
	AfterDataMap  map[string]interface{}
	Operation     string
}

type CheckField

type CheckField struct {
	BaseHandler
}

func (*CheckField) HandlerData

func (uf *CheckField) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type CombineArray

type CombineArray struct {
	BaseHandler
}

func (*CombineArray) HandlerData

func (uf *CombineArray) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type Count2Map

type Count2Map struct {
	BaseHandler
}

func (*Count2Map) HandlerData

func (pr *Count2Map) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type Data2Excel

type Data2Excel struct {
	BaseHandler
}

func (*Data2Excel) HandlerData

func (uf *Data2Excel) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type DatabaseModel

type DatabaseModel interface {
	GetModel(tableName string) interface{}
	CloneModel(tableName string) interface{}
	GetPrimaryKey(tableName string) []string
}

type EmptyService

type EmptyService struct {
	BaseHandler
}

func (*EmptyService) Result

func (s *EmptyService) Result(template *config.Template, ts *TemplateService) *common.Result

type Excel2Data

type Excel2Data struct {
	BaseHandler
}

func (*Excel2Data) HandlerData

func (uf *Excel2Data) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type Field2Array

type Field2Array struct {
	BaseHandler
}

func (*Field2Array) HandlerData

func (uf *Field2Array) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type File2DataJson

type File2DataJson struct {
	BaseHandler
}

func (*File2DataJson) HandlerData

func (uf *File2DataJson) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type File2Result

type File2Result struct {
	BaseHandler
}

func (*File2Result) HandlerData

func (uf *File2Result) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type FilterArr

type FilterArr struct {
	BaseHandler
}

func (*FilterArr) HandlerData

func (uf *FilterArr) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type GetModifyData

type GetModifyData struct {
	BaseHandler
}

func (*GetModifyData) HandlerData

func (uf *GetModifyData) HandlerData(template *config.Template, _ *config.HandlerParam, ts *TemplateService) *common.Result

type GetRequestHandler

type GetRequestHandler struct {
	BaseRequestHandler
}

func (*GetRequestHandler) GetBody

func (t *GetRequestHandler) GetBody() io.Reader

func (*GetRequestHandler) HandlerRequest

func (t *GetRequestHandler) HandlerRequest() *common.Result

type GroupBy

type GroupBy struct {
	BaseHandler
}

func (*GroupBy) HandlerData

func (uf *GroupBy) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type HandlerCache

type HandlerCache struct {
	BaseHandler
}

处理缓存

func (*HandlerCache) HandlerData

func (hc *HandlerCache) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type HandlerData

type HandlerData interface {
	Handler() ([]map[string]interface{}, bool)
	Transfer(dataList []map[string]interface{}) []map[string]interface{}
}

type HttpService

type HttpService struct {
	BaseHandler
}

func (*HttpService) Result

func (s *HttpService) Result(template *config.Template, ts *TemplateService) *common.Result

type IgnoreData

type IgnoreData struct {
	BaseHandler
}

func (*IgnoreData) HandlerData

func (uf *IgnoreData) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

删除数组数据

type Ldap

type Ldap struct {
	Connection     LdapConnection
	Method         string
	SearchParams   ldap.SearchRequest
	AddParams      ldap.AddRequest
	ModifyParams   ldap.ModifyRequest
	DeleteParams   ldap.DelRequest
	ModifyDnParams ldap.ModifyDNRequest
	Split          string
}

type LdapConnection

type LdapConnection struct {
	Server   string
	User     string
	Password string
}
type LdapRequest struct {
	ldap.SearchRequest
}

type LdapService

type LdapService struct {
	BaseHandler
}

func (*LdapService) Result

func (s *LdapService) Result(template *config.Template, ts *TemplateService) *common.Result

* * 连接信息直接json 转的

type ModelDeleteService

type ModelDeleteService struct {
	BaseHandler
}

func (*ModelDeleteService) Result

func (s *ModelDeleteService) Result(template *config.Template, ts *TemplateService) *common.Result

type ModelSaveService

type ModelSaveService struct {
	BaseHandler
}

func (*ModelSaveService) Result

func (s *ModelSaveService) Result(template *config.Template, ts *TemplateService) *common.Result

type ModelUpdateService

type ModelUpdateService struct {
	BaseHandler
}

func (*ModelUpdateService) Result

func (s *ModelUpdateService) Result(template *config.Template, ts *TemplateService) *common.Result

type ModuleResult

type ModuleResult interface {
	// Result 执行结果
	Result(template *collect.Template, t *TemplateService) *common.Result
	// HandlerData 处理数据
	HandlerData(template *collect.Template, handlerParam *collect.HandlerParam, t *TemplateService) *common.Result
}

func GetModuleRegister

func GetModuleRegister(name string) ModuleResult

func GetRegisterList

func GetRegisterList() []ModuleResult

type Param2Result

type Param2Result struct {
	BaseHandler
}

func (*Param2Result) HandlerData

func (pr *Param2Result) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type Params2Result

type Params2Result struct {
	BaseHandler
}

func (*Params2Result) HandlerData

func (pr *Params2Result) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type PostRequestHandler

type PostRequestHandler struct {
	BaseRequestHandler
}

type PreventDuplication

type PreventDuplication struct {
	BaseHandler
}

处理缓存

func (*PreventDuplication) HandlerData

func (hc *PreventDuplication) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type PropArr

type PropArr struct {
	BaseHandler
}

* * 接收数组

func (*PropArr) HandlerData

func (uf *PropArr) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type RequestHandler

type RequestHandler interface {
	SetConfig(*config.HttpConfig)
	GetConfig() *config.HttpConfig
	GetParams() map[string]interface{}
	SetParams(map[string]interface{})
	GetMethod() string
	GetUrl() string
	SetUrl(url string)
	GetBody() io.Reader
	SetBody(io.Reader)
	CreateRequest() *common.Result
	HandlerRequest() *common.Result
	GetResult() *common.Result
	GetLogData() map[string]interface{}
	GetData() interface{}
	SetData(data interface{})
	Close()
}

func GetHandler

func GetHandler(config *config.HttpConfig, params map[string]interface{}) RequestHandler

type Result2Map

type Result2Map struct {
	BaseHandler
}

func (*Result2Map) HandlerData

func (pr *Result2Map) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type Result2Params

type Result2Params struct {
	BaseHandler
}

func (*Result2Params) HandlerData

func (pr *Result2Params) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type Service2Field

type Service2Field struct {
	BaseHandler
}

func (*Service2Field) HandlerData

func (uf *Service2Field) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

* * 只做了拼接参数,未做渲染

type ServiceFlowService

type ServiceFlowService struct {
	BaseHandler
	BaseFlow
}

func (*ServiceFlowService) Result

func (s *ServiceFlowService) Result(template *config.Template, ts *TemplateService) *common.Result

Result 服务流程化

type SessionAdd

type SessionAdd struct {
	BaseHandler
}

func (*SessionAdd) HandlerData

func (sa *SessionAdd) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type SessionGet

type SessionGet struct {
	BaseHandler
}

func (*SessionGet) HandlerData

func (sa *SessionGet) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type SessionRemove

type SessionRemove struct {
	BaseHandler
}

func (*SessionRemove) HandlerData

func (sr *SessionRemove) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type SimpleArrayRule

type SimpleArrayRule struct {
	BaseRule
}

func (*SimpleArrayRule) Handler

func (s *SimpleArrayRule) Handler() ([]map[string]interface{}, bool)

type SimpleFieldRule

type SimpleFieldRule struct {
	BaseRule
}

func (*SimpleFieldRule) Handler

func (s *SimpleFieldRule) Handler() ([]map[string]interface{}, bool)

type SqlService

type SqlService struct {
	BaseHandler
}

func (*SqlService) Result

func (s *SqlService) Result(template *config.Template, ts *TemplateService) *common.Result

type TemplateService

type TemplateService struct {
	OpUser string

	Request          interface{}
	IsFileResponse   bool
	ResponseFilePath string
	ResponseFileName string
	File             multipart.File // 单个上传文件
	// contains filtered or unexported fields
}

func (*TemplateService) CloneModel

func (*TemplateService) CloneModel(tableName string) interface{}

func (*TemplateService) GetModel

func (*TemplateService) GetModel(tableName string) interface{}

func (*TemplateService) GetPrimaryKey

func (*TemplateService) GetPrimaryKey(tableName string) []string

func (*TemplateService) GetSession

func (t *TemplateService) GetSession() *sessions.Session

GetSession 获取session

func (*TemplateService) GetThirdData

func (s *TemplateService) GetThirdData(key string) interface{}

扩展模块获取

func (*TemplateService) HasThirdData

func (s *TemplateService) HasThirdData(key string) bool

func (*TemplateService) RemoveThirdData

func (s *TemplateService) RemoveThirdData(key string)

扩展模块获取

func (*TemplateService) Result

func (t *TemplateService) Result(params map[string]interface{}, isHttp bool) *common.Result

func (*TemplateService) ResultInner

func (t *TemplateService) ResultInner(params map[string]interface{}) *common.Result

func (*TemplateService) SetSession

func (t *TemplateService) SetSession(session *sessions.Session)

func (*TemplateService) SetThirdData

func (s *TemplateService) SetThirdData(key string, value interface{})

扩展模块设置

type ToList

type ToList struct {
	BaseHandler
}

func (*ToList) HandlerData

func (uf *ToList) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type ToTree

type ToTree struct {
	BaseHandler
}

func (*ToTree) HandlerData

func (uf *ToTree) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type UpdateArray

type UpdateArray struct {
	BaseHandler
}

func (*UpdateArray) HandlerData

func (uf *UpdateArray) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type UpdateArrayFromArray

type UpdateArrayFromArray struct {
	BaseHandler
}

func (*UpdateArrayFromArray) HandlerData

func (uf *UpdateArrayFromArray) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type UpdateField

type UpdateField struct {
	BaseHandler
}

func (*UpdateField) HandlerData

func (uf *UpdateField) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

type UpdateOrder

type UpdateOrder struct {
	BaseHandler
}

func (*UpdateOrder) HandlerData

func (uf *UpdateOrder) HandlerData(template *config.Template, handlerParam *config.HandlerParam, ts *TemplateService) *common.Result

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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