初步搭建

This commit is contained in:
des
2026-01-13 00:08:49 +08:00
parent d7854bbf1d
commit 0c68d57180
7 changed files with 114 additions and 14 deletions

View File

@@ -0,0 +1,21 @@
package common
import (
"gorm.io/driver/postgres"
"gorm.io/gorm"
)
func GetDataBaseClient() *gorm.DB {
dsn := "host=localhost " +
"user=gatekeeper " +
"dbname=crimson " +
"sslmode=disable " +
"port=5432 " +
"password=crimson " +
"connect_timeout=20 "
client, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})
if err != nil {
panic("无法连接数据库")
}
return client
}

View File

@@ -0,0 +1,17 @@
package user
import (
"net/http"
"github.com/labstack/echo"
)
type Controller struct{}
func (Controller) GetLogin(ctx echo.Context) error {
return ctx.String(http.StatusOK, "success")
}
func New() *Controller {
return &Controller{}
}