This commit is contained in:
2023-04-18 15:22:01 +08:00
parent 2187b7fdbb
commit 62f2e55ffa
8 changed files with 143 additions and 0 deletions

24
models/Task.go Normal file
View File

@@ -0,0 +1,24 @@
package models
import (
"database/sql"
"log"
_ "github.com/mattn/go-sqlite3"
)
type Task struct {
ID string `json:"id"`
Type string `json:"type"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
// 使用SQLite3初始化數據庫
func init() {
db, err := sql.Open("sqlite3", "task.db")
if err != nil {
log.Fatal(err)
}
defer db.Close()
}