This commit is contained in:
Hericium-sys
2026-04-25 13:26:02 +08:00
commit 62b87c6002
29 changed files with 1884 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package example
import (
"net/http"
"skeleton/utils"
"github.com/gin-gonic/gin"
)
// ExampleController 示例控制器
type ExampleController struct {
service *ExampleService
}
// NewExampleController 创建示例控制器
func NewExampleController() *ExampleController {
return &ExampleController{
service: NewExampleService(),
}
}
// Hello 示例接口
func (c *ExampleController) Hello(ctx *gin.Context) {
ctx.JSON(http.StatusOK, utils.Success(c.service.Hello()))
}
+16
View File
@@ -0,0 +1,16 @@
package example
// ExampleService 示例服务
type ExampleService struct{}
// NewExampleService 创建示例服务
func NewExampleService() *ExampleService {
return &ExampleService{}
}
// Hello 返回示例消息
func (s *ExampleService) Hello() HelloResponse {
return HelloResponse{
Message: "hello from skeleton example",
}
}
+6
View File
@@ -0,0 +1,6 @@
package example
// HelloResponse 示例响应
type HelloResponse struct {
Message string `json:"message"`
}
+6
View File
@@ -0,0 +1,6 @@
package example
// normalizeMessage 示例模块私有工具
func normalizeMessage(message string) string {
return message
}