Compare commits
No commits in common. "main" and "v1.0.00022" have entirely different histories.
main
...
v1.0.00022
|
|
@ -90,7 +90,6 @@
|
||||||
<entry key="NewsOne">
|
<entry key="NewsOne">
|
||||||
<value>
|
<value>
|
||||||
<set>
|
<set>
|
||||||
<option value="file://$PROJECT_DIR$/../gin_test/api/new.go" />
|
|
||||||
<option value="file://$PROJECT_DIR$/../gin_test/req/new.go" />
|
<option value="file://$PROJECT_DIR$/../gin_test/req/new.go" />
|
||||||
</set>
|
</set>
|
||||||
</value>
|
</value>
|
||||||
|
|
@ -98,7 +97,6 @@
|
||||||
<entry key="NewsSave">
|
<entry key="NewsSave">
|
||||||
<value>
|
<value>
|
||||||
<set>
|
<set>
|
||||||
<option value="file://$PROJECT_DIR$/../gin_test/api/new.go" />
|
|
||||||
<option value="file://$PROJECT_DIR$/../gin_test/req/new.go" />
|
<option value="file://$PROJECT_DIR$/../gin_test/req/new.go" />
|
||||||
</set>
|
</set>
|
||||||
</value>
|
</value>
|
||||||
|
|
@ -201,7 +199,7 @@
|
||||||
<entry key="file://$PROJECT_DIR$/database/database.go">
|
<entry key="file://$PROJECT_DIR$/database/database.go">
|
||||||
<value>
|
<value>
|
||||||
<ScannedPath>
|
<ScannedPath>
|
||||||
<option name="lastModified" value="1770258641711" />
|
<option name="lastModified" value="1770100613057" />
|
||||||
</ScannedPath>
|
</ScannedPath>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
@ -342,7 +340,7 @@
|
||||||
<entry key="file://$PROJECT_DIR$/valid/valid.go">
|
<entry key="file://$PROJECT_DIR$/valid/valid.go">
|
||||||
<value>
|
<value>
|
||||||
<ScannedPath>
|
<ScannedPath>
|
||||||
<option name="lastModified" value="1770197737203" />
|
<option name="lastModified" value="1770188678912" />
|
||||||
</ScannedPath>
|
</ScannedPath>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
@ -368,47 +366,6 @@
|
||||||
</ScannedPath>
|
</ScannedPath>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="file://$PROJECT_DIR$/../gin_test/api/home.go">
|
|
||||||
<value>
|
|
||||||
<ScannedPath>
|
|
||||||
<option name="lastModified" value="1770190095707" />
|
|
||||||
</ScannedPath>
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
<entry key="file://$PROJECT_DIR$/../gin_test/api/new.go">
|
|
||||||
<value>
|
|
||||||
<ScannedPath>
|
|
||||||
<option name="lastModified" value="1770191206242" />
|
|
||||||
<option name="schema">
|
|
||||||
<list>
|
|
||||||
<option value="NewsOne" />
|
|
||||||
<option value="NewsSave" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</ScannedPath>
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
<entry key="file://$PROJECT_DIR$/../gin_test/controller/home/houeRouter.go">
|
|
||||||
<value>
|
|
||||||
<ScannedPath>
|
|
||||||
<option name="lastModified" value="1770191001042" />
|
|
||||||
</ScannedPath>
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
<entry key="file://$PROJECT_DIR$/../gin_test/controller/home/index.go">
|
|
||||||
<value>
|
|
||||||
<ScannedPath>
|
|
||||||
<option name="lastModified" value="1770255253603" />
|
|
||||||
</ScannedPath>
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
<entry key="file://$PROJECT_DIR$/../gin_test/controller/home/router.go">
|
|
||||||
<value>
|
|
||||||
<ScannedPath>
|
|
||||||
<option name="lastModified" value="1770190557848" />
|
|
||||||
</ScannedPath>
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
<entry key="file://$PROJECT_DIR$/../gin_test/req/new.go">
|
<entry key="file://$PROJECT_DIR$/../gin_test/req/new.go">
|
||||||
<value>
|
<value>
|
||||||
<ScannedPath>
|
<ScannedPath>
|
||||||
|
|
@ -425,7 +382,7 @@
|
||||||
<entry key="file://$PROJECT_DIR$/../gin_test/router/router.go">
|
<entry key="file://$PROJECT_DIR$/../gin_test/router/router.go">
|
||||||
<value>
|
<value>
|
||||||
<ScannedPath>
|
<ScannedPath>
|
||||||
<option name="lastModified" value="1770191024510" />
|
<option name="lastModified" value="1770188593199" />
|
||||||
</ScannedPath>
|
</ScannedPath>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
|
||||||
|
|
@ -68,12 +68,10 @@ func mysqlInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func sqliteInit() {
|
func sqliteInit() {
|
||||||
if !gfile.Exists(dns.String()) {
|
|
||||||
_, err = gfile.Create(dns.String())
|
_, err = gfile.Create(dns.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("创建数据库文件失败: ", err)
|
log.Error("创建数据库文件失败: ", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Type = sqlite.Open(fmt.Sprintf("%s?cache=shared&mode=rwc&_busy_timeout=10000&_fk=1&_journal=WAL&_sync=FULL", dns.String()))
|
Type = sqlite.Open(fmt.Sprintf("%s?cache=shared&mode=rwc&_busy_timeout=10000&_fk=1&_journal=WAL&_sync=FULL", dns.String()))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import (
|
||||||
// ValidToStruct 验证参数并返回结构体
|
// ValidToStruct 验证参数并返回结构体
|
||||||
func ValidToStruct[T any](c *gin.Context) (object *T) {
|
func ValidToStruct[T any](c *gin.Context) (object *T) {
|
||||||
obj := new(T)
|
obj := new(T)
|
||||||
if err := c.Bind(obj); err != nil {
|
if err := c.BindJSON(obj); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if err := g.Validator().Data(obj).Run(c); err != nil {
|
if err := g.Validator().Data(obj).Run(c); err != nil {
|
||||||
|
|
@ -19,22 +19,10 @@ func ValidToStruct[T any](c *gin.Context) (object *T) {
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidToMap 验证参数并返回结构体
|
|
||||||
func ValidToMap[T any](c *gin.Context) (object map[string]any) {
|
|
||||||
obj := new(T)
|
|
||||||
if err := c.Bind(obj); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
if err := g.Validator().Data(obj).Run(c); err != nil {
|
|
||||||
panic(gerror.Current(err).Error())
|
|
||||||
}
|
|
||||||
return gconv.Map(obj)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidToStructAndMap 验证参数并返回map
|
// ValidToStructAndMap 验证参数并返回map
|
||||||
func ValidToStructAndMap[T any](c *gin.Context) (stru *T, object map[string]any) {
|
func ValidToStructAndMap[T any](c *gin.Context) (stru *T, object map[string]any) {
|
||||||
obj := new(T)
|
obj := new(T)
|
||||||
if err := c.Bind(obj); err != nil {
|
if err := c.BindJSON(obj); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if err := g.Validator().Data(obj).Run(c); err != nil {
|
if err := g.Validator().Data(obj).Run(c); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue