Skip to content

Commit

Permalink
[change] migrate processes
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Nov 10, 2022
1 parent 55ebd75 commit 2a60fe1
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 80 deletions.
7 changes: 5 additions & 2 deletions crypto/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import (
)

func init() {
gou.RegisterProcessHandler("yao.crypto.hash", ProcessHash)
gou.RegisterProcessHandler("yao.crypto.hmac", ProcessHmac)
gou.RegisterProcessHandler("yao.crypto.hash", ProcessHash) // deprecated → crypto.Hash
gou.RegisterProcessHandler("yao.crypto.hmac", ProcessHmac) // deprecated → crypto.Hash

gou.AliasProcess("yao.crypto.hash", "crypto.Hash")
gou.AliasProcess("yao.crypto.hmac", "crypto.Hmac")
}

// ProcessHash yao.crypto.hash Crypto Hash
Expand Down
14 changes: 7 additions & 7 deletions engine/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ import (

func init() {
// 注册处理器
gou.RegisterProcessHandler("xiang.main.Ping", processPing)
gou.AliasProcess("xiang.main.Ping", "xiang.sys.Ping")
gou.RegisterProcessHandler("xiang.main.Ping", processPing) // deprecated → utils.app.Ping @/utils/process.go
gou.AliasProcess("xiang.main.Ping", "xiang.sys.Ping") // deprecated

gou.RegisterProcessHandler("xiang.main.FileContent", processFileContent)
gou.RegisterProcessHandler("xiang.main.AppFileContent", processAppFileContent)
gou.RegisterProcessHandler("xiang.main.FileContent", processFileContent) // deprecated
gou.RegisterProcessHandler("xiang.main.AppFileContent", processAppFileContent) // deprecated

gou.RegisterProcessHandler("xiang.main.Inspect", processInspect)
gou.AliasProcess("xiang.main.Inspect", "xiang.sys.Inspect")
gou.RegisterProcessHandler("xiang.main.Inspect", processInspect) // deprecated → utils.app.Inspect @/utils/process.go
gou.AliasProcess("xiang.main.Inspect", "xiang.sys.Inspect") // deprecated

gou.RegisterProcessHandler("xiang.main.Favicon", processFavicon)
gou.RegisterProcessHandler("xiang.main.Favicon", processFavicon) // deprecated
}

// processCreate 运行模型 MustCreate
Expand Down
126 changes: 63 additions & 63 deletions helper/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,71 +9,71 @@ import (

func init() {
// 注册处理器
gou.RegisterProcessHandler("xiang.helper.ArrayGet", ProcessArrayGet)
gou.RegisterProcessHandler("xiang.helper.ArrayIndexes", ProcessArrayIndexes)
gou.RegisterProcessHandler("xiang.helper.ArrayPluck", ProcessArrayPluck)
gou.RegisterProcessHandler("xiang.helper.ArraySplit", ProcessArraySplit)
gou.RegisterProcessHandler("xiang.helper.ArrayColumn", ProcessArrayColumn)
gou.RegisterProcessHandler("xiang.helper.ArrayKeep", ProcessArrayKeep)
gou.RegisterProcessHandler("xiang.helper.ArrayTree", ProcessArrayTree)
gou.RegisterProcessHandler("xiang.helper.ArrayUnique", ProcessArrayUnique)
gou.RegisterProcessHandler("xiang.helper.ArrayGet", ProcessArrayGet) // deprecated → utils.arr.Get @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.ArrayIndexes", ProcessArrayIndexes) // deprecated → utils.arr.Indexes @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.ArrayPluck", ProcessArrayPluck) // deprecated → utils.arr.Pluck @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.ArraySplit", ProcessArraySplit) // deprecated → utils.arr.Split @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.ArrayColumn", ProcessArrayColumn) // deprecated → utils.arr.Column @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.ArrayKeep", ProcessArrayKeep) // deprecated → utils.arr.Keep @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.ArrayTree", ProcessArrayTree) // deprecated → utils.arr.Tree @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.ArrayUnique", ProcessArrayUnique) // deprecated → utils.arr.Unique @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.ArrayMapSet", ProcessArrayMapSet)

gou.RegisterProcessHandler("xiang.helper.MapKeys", ProcessMapKeys)
gou.RegisterProcessHandler("xiang.helper.MapValues", ProcessMapValues)
gou.RegisterProcessHandler("xiang.helper.MapToArray", ProcessMapToArray)
gou.RegisterProcessHandler("xiang.helper.MapGet", ProcessMapGet)
gou.RegisterProcessHandler("xiang.helper.MapSet", ProcessMapSet)
gou.RegisterProcessHandler("xiang.helper.MapDel", ProcessMapDel)
gou.RegisterProcessHandler("xiang.helper.MapMultiDel", ProcessMapMultiDel)

gou.RegisterProcessHandler("xiang.helper.HexToString", ProcessHexToString)

gou.RegisterProcessHandler("xiang.helper.StrConcat", ProcessStrConcat)

gou.RegisterProcessHandler("xiang.helper.Captcha", ProcessCaptcha)
gou.RegisterProcessHandler("xiang.helper.CaptchaValidate", ProcessCaptchaValidate)

gou.RegisterProcessHandler("xiang.helper.PasswordValidate", ProcessPasswordValidate)

gou.RegisterProcessHandler("xiang.helper.JwtMake", ProcessJwtMake)
gou.RegisterProcessHandler("xiang.helper.JwtValidate", ProcessJwtValidate)

gou.RegisterProcessHandler("xiang.helper.For", ProcessFor)
gou.AliasProcess("xiang.helper.For", "xiang.flow.For")
gou.RegisterProcessHandler("xiang.helper.Each", ProcessEach)
gou.AliasProcess("xiang.helper.Each", "xiang.flow.Each")
gou.RegisterProcessHandler("xiang.helper.Case", ProcessCase)
gou.AliasProcess("xiang.helper.Case", "xiang.flow.Case")
gou.RegisterProcessHandler("xiang.helper.IF", ProcessIF)
gou.AliasProcess("xiang.helper.IF", "xiang.flow.IF")
gou.RegisterProcessHandler("xiang.helper.Throw", ProcessThrow)
gou.AliasProcess("xiang.helper.Throw", "xiang.flow.Throw")
gou.RegisterProcessHandler("xiang.helper.Return", ProcessReturn)
gou.AliasProcess("xiang.helper.Return", "xiang.flow.Return")

gou.RegisterProcessHandler("xiang.helper.EnvSet", ProcessEnvSet)
gou.AliasProcess("xiang.helper.EnvSet", "xiang.env.Set")
gou.AliasProcess("xiang.helper.EnvSet", "yao.env.Set")

gou.RegisterProcessHandler("xiang.helper.EnvGet", ProcessEnvGet)
gou.AliasProcess("xiang.helper.EnvGet", "xiang.env.Get")
gou.AliasProcess("xiang.helper.EnvGet", "yao.env.Get")

gou.RegisterProcessHandler("xiang.helper.EnvMultiSet", ProcessEnvMultiSet)
gou.AliasProcess("xiang.helper.EnvMultiSet", "xiang.env.MultiSet")
gou.AliasProcess("xiang.helper.EnvMultiSet", "yao.env.MultiSet")

gou.RegisterProcessHandler("xiang.helper.EnvMultiGet", ProcessEnvMultiGet)
gou.AliasProcess("xiang.helper.EnvMultiGet", "xiang.env.MultiGet")
gou.AliasProcess("xiang.helper.EnvMultiGet", "yao.env.MultiGet")

gou.RegisterProcessHandler("xiang.helper.Print", ProcessPrint)
gou.AliasProcess("xiang.helper.Print", "xiang.sys.Print")

gou.RegisterProcessHandler("xiang.flow.Sleep", ProcessSleep)
gou.AliasProcess("xiang.flow.Sleep", "xiang.sys.Sleep")
gou.AliasProcess("xiang.flow.Sleep", "yao.sys.Sleep")
gou.RegisterProcessHandler("xiang.helper.MapKeys", ProcessMapKeys) // deprecated → utils.map.Keys @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.MapValues", ProcessMapValues) // deprecated → utils.map.Values @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.MapToArray", ProcessMapToArray) // deprecated → utils.map.Array @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.MapGet", ProcessMapGet) // deprecated → utils.map.Get @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.MapSet", ProcessMapSet) // deprecated → utils.map.Set @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.MapDel", ProcessMapDel) // deprecated → utils.map.Del @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.MapMultiDel", ProcessMapMultiDel) // deprecated → utils.map.DelMany @/utils/process.go

gou.RegisterProcessHandler("xiang.helper.HexToString", ProcessHexToString) // deprecated

gou.RegisterProcessHandler("xiang.helper.StrConcat", ProcessStrConcat) // deprecated → utils.str.Concat @/utils/process.go

gou.RegisterProcessHandler("xiang.helper.Captcha", ProcessCaptcha) // deprecated → utils.captcha.Make @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.CaptchaValidate", ProcessCaptchaValidate) // deprecated → utils.captcha.Verify @/utils/process.go

gou.RegisterProcessHandler("xiang.helper.PasswordValidate", ProcessPasswordValidate) // deprecated → utils.pwd.Verify @/utils/process.go

gou.RegisterProcessHandler("xiang.helper.JwtMake", ProcessJwtMake) // deprecated → utils.jwt.Make @/utils/process.go
gou.RegisterProcessHandler("xiang.helper.JwtValidate", ProcessJwtValidate) // deprecated → utils.jwt.Verify @/utils/process.go

gou.RegisterProcessHandler("xiang.helper.For", ProcessFor) // deprecated → utils.flow.For @/utils/process.go
gou.AliasProcess("xiang.helper.For", "xiang.flow.For") // deprecated
gou.RegisterProcessHandler("xiang.helper.Each", ProcessEach) // deprecated → utils.flow.Each @/utils/process.go
gou.AliasProcess("xiang.helper.Each", "xiang.flow.Each") // deprecated
gou.RegisterProcessHandler("xiang.helper.Case", ProcessCase) // deprecated → utils.flow.Case @/utils/process.go
gou.AliasProcess("xiang.helper.Case", "xiang.flow.Case") // deprecated
gou.RegisterProcessHandler("xiang.helper.IF", ProcessIF) // deprecated → utils.flow.IF @/utils/process.go
gou.AliasProcess("xiang.helper.IF", "xiang.flow.IF") // deprecated
gou.RegisterProcessHandler("xiang.helper.Throw", ProcessThrow) // deprecated → utils.flow.Throw @/utils/process.go
gou.AliasProcess("xiang.helper.Throw", "xiang.flow.Throw") // deprecated
gou.RegisterProcessHandler("xiang.helper.Return", ProcessReturn) // deprecated → utils.flow.Return @/utils/process.go
gou.AliasProcess("xiang.helper.Return", "xiang.flow.Return") // deprecated

gou.RegisterProcessHandler("xiang.helper.EnvSet", ProcessEnvSet) // deprecated → utils.env.Set @/utils/process.go
gou.AliasProcess("xiang.helper.EnvSet", "xiang.env.Set") // deprecated
gou.AliasProcess("xiang.helper.EnvSet", "yao.env.Set") // deprecated

gou.RegisterProcessHandler("xiang.helper.EnvGet", ProcessEnvGet) // deprecated → utils.env.Get @/utils/process.go
gou.AliasProcess("xiang.helper.EnvGet", "xiang.env.Get") // deprecated
gou.AliasProcess("xiang.helper.EnvGet", "yao.env.Get") // deprecated

gou.RegisterProcessHandler("xiang.helper.EnvMultiSet", ProcessEnvMultiSet) // deprecated → utils.env.SetMany @/utils/process.go
gou.AliasProcess("xiang.helper.EnvMultiSet", "xiang.env.MultiSet") // deprecated
gou.AliasProcess("xiang.helper.EnvMultiSet", "yao.env.MultiSet") // deprecated

gou.RegisterProcessHandler("xiang.helper.EnvMultiGet", ProcessEnvMultiGet) // deprecated → utils.env.GetMany @/utils/process.go
gou.AliasProcess("xiang.helper.EnvMultiGet", "xiang.env.MultiGet") // deprecated
gou.AliasProcess("xiang.helper.EnvMultiGet", "yao.env.MultiGet") // deprecated

gou.RegisterProcessHandler("xiang.helper.Print", ProcessPrint) // deprecated → utils.fmt.Println @/utils/process.go
gou.AliasProcess("xiang.helper.Print", "xiang.sys.Print") // deprecated

gou.RegisterProcessHandler("xiang.flow.Sleep", ProcessSleep) // deprecated → utils.time.Sleep @/utils/process.go
gou.AliasProcess("xiang.flow.Sleep", "xiang.sys.Sleep") // deprecated
gou.AliasProcess("xiang.flow.Sleep", "yao.sys.Sleep") // deprecated

}

Expand Down
20 changes: 14 additions & 6 deletions importer/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ import (
)

func init() {

// 注册处理器
gou.RegisterProcessHandler("xiang.import.Run", ProcessRun)
gou.RegisterProcessHandler("xiang.import.Data", ProcessData)
gou.RegisterProcessHandler("xiang.import.Setting", ProcessSetting)
gou.RegisterProcessHandler("xiang.import.DataSetting", ProcessDataSetting)
gou.RegisterProcessHandler("xiang.import.Mapping", ProcessMapping)
gou.RegisterProcessHandler("xiang.import.MappingSetting", ProcessMappingSetting)
gou.RegisterProcessHandler("xiang.import.Run", ProcessRun) // deprecated → yao.import.Run
gou.RegisterProcessHandler("xiang.import.Data", ProcessData) // deprecated → yao.import.Data
gou.RegisterProcessHandler("xiang.import.Setting", ProcessSetting) // deprecated → yao.import.Setting
gou.RegisterProcessHandler("xiang.import.DataSetting", ProcessDataSetting) // deprecated → yao.import.DataSetting
gou.RegisterProcessHandler("xiang.import.Mapping", ProcessMapping) // deprecated → yao.import.Mapping
gou.RegisterProcessHandler("xiang.import.MappingSetting", ProcessMappingSetting) // deprecated → yao.import.MappingSetting

gou.AliasProcess("xiang.import.Run", "yao.import.Run")
gou.AliasProcess("xiang.import.Data", "yao.import.Data")
gou.AliasProcess("xiang.import.Setting", "yao.import.Setting")
gou.AliasProcess("xiang.import.DataSetting", "yao.import.DataSetting")
gou.AliasProcess("xiang.import.Mapping", "yao.import.Mapping")
gou.AliasProcess("xiang.import.MappingSetting", "yao.import.MappingSetting")
}

// ProcessRun xiang.import.Run
Expand Down
68 changes: 66 additions & 2 deletions utils/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,70 @@ package utils
import "github.com/yaoapp/gou"

func init() {
gou.AliasProcess("xiang.helper.Captcha", "yao.utils.Captcha")
gou.AliasProcess("xiang.helper.CaptchaValidate", "yao.utils.CaptchaValidate")
gou.AliasProcess("xiang.helper.Captcha", "yao.utils.Captcha") // deprecated
gou.AliasProcess("xiang.helper.CaptchaValidate", "yao.utils.CaptchaValidate") // deprecated

// ****************************************
// * Migrate Processes Version 0.10.2+
// ****************************************

// Application
gou.AliasProcess("xiang.main.Ping", "utils.app.Ping")
gou.AliasProcess("xiang.main.Inspect", "utils.app.Inspect")

// FMT
gou.AliasProcess("xiang.helper.Print", "utils.fmt.Print")

// ENV
gou.AliasProcess("xiang.helper.EnvSet", "utils.env.Get")
gou.AliasProcess("xiang.helper.EnvGet", "utils.env.Get")
gou.AliasProcess("xiang.helper.EnvMultiSet", "utils.env.SetMany")
gou.AliasProcess("xiang.helper.EnvMultiGet", "utils.env.GetMany")

// Flow
gou.AliasProcess("xiang.helper.For", "utils.flow.For")
gou.AliasProcess("xiang.helper.Each", "utils.flow.Each")
gou.AliasProcess("xiang.helper.Case", "utils.flow.Case")
gou.AliasProcess("xiang.helper.IF", "utils.flow.IF")
gou.AliasProcess("xiang.helper.Throw", "utils.flow.Throw")
gou.AliasProcess("xiang.helper.Return", "utils.flow.Return")

// JWT
gou.AliasProcess("xiang.helper.JwtMake", "utils.jwt.Make")
gou.AliasProcess("xiang.helper.JwtValidate", "utils.jwt.Verify")

// Password
// utils.pwd.Hash
gou.AliasProcess("xiang.helper.PasswordValidate", "utils.pwd.Verify")

// Captcha
gou.AliasProcess("xiang.helper.Captcha", "utils.captcha.Make")
gou.AliasProcess("xiang.helper.CaptchaValidate", "utils.captcha.Verify")

// String
gou.AliasProcess("xiang.helper.StrConcat", "utils.str.Concat")

// Array
gou.AliasProcess("xiang.helper.ArrayPluck", "utils.arr.Pluck")
gou.AliasProcess("xiang.helper.ArraySplit", "utils.arr.Split")
gou.AliasProcess("xiang.helper.ArrayTree", "utils.arr.Tree")
gou.AliasProcess("xiang.helper.ArrayUnique", "utils.arr.Unique")
gou.AliasProcess("xiang.helper.ArrayIndexes", "utils.arr.Indexes")
gou.AliasProcess("xiang.helper.ArrayGet", "utils.arr.Get")
gou.AliasProcess("xiang.helper.ArrayColumn", "utils.arr.Column") // doc
gou.AliasProcess("xiang.helper.ArrayKeep", "utils.arr.Keep")

// Map
gou.AliasProcess("xiang.helper.MapGet", "utils.map.Get")
gou.AliasProcess("xiang.helper.MapSet", "utils.map.Set")
gou.AliasProcess("xiang.helper.MapDel", "utils.map.Del")
gou.AliasProcess("xiang.helper.MapDel", "utils.map.DelMany")
gou.AliasProcess("xiang.helper.MapKeys", "utils.map.Keys")
gou.AliasProcess("xiang.helper.MapValues", "utils.map.Values")
gou.AliasProcess("xiang.helper.MapToArray", "utils.map.Array") // doc
// utils.map.Merge

// Time
gou.AliasProcess("xiang.flow.Sleep", "utils.time.Sleep")

}

0 comments on commit 2a60fe1

Please sign in to comment.