model
This commit is contained in:
25
models/User.go
Normal file
25
models/User.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"log"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ID string `json:"id"`
|
||||
UserName string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
||||
// 使用SQLite3初始化數據庫
|
||||
func init() {
|
||||
db, err := sql.Open("sqlite3", "user.db")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer db.Close()
|
||||
}
|
Reference in New Issue
Block a user