Init: bootstrap go module with basic framework
This commit is contained in:
10
utils/initDB.go
Normal file
10
utils/initDB.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"gitea.konchin.com/service/amane-tanikaze-dcbot/amane/models"
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
func InitDB(db *bun.DB) {
|
||||
db.RegisterModel((*models.AliasToImage)(nil))
|
||||
}
|
||||
14
utils/success.go
Normal file
14
utils/success.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Success(w http.ResponseWriter) error {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
_, err := io.WriteString(w,
|
||||
`{"code":200, "message": "success"}`+"\n")
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user