Add Models, Add Database
This commit is contained in:
parent
8f90344870
commit
faee833481
21 changed files with 407 additions and 1 deletions
6
entities/event/edu.go
Normal file
6
entities/event/edu.go
Normal file
|
@ -0,0 +1,6 @@
|
|||
package event
|
||||
|
||||
type EDU struct {
|
||||
Type string `json:"type,omitempty"`
|
||||
Content string `json:"content,omitempty"`
|
||||
}
|
10
entities/event/event.go
Normal file
10
entities/event/event.go
Normal file
|
@ -0,0 +1,10 @@
|
|||
package event
|
||||
|
||||
type Event struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
RoomId string `json:"roomId,omitempty"`
|
||||
EventType string `json:"eventType,omitempty"`
|
||||
Content string `json:"content,omitempty"`
|
||||
Parent string `json:"parent,omitempty"`
|
||||
Depth int `json:"depth,omitempty"`
|
||||
}
|
18
entities/event/eventController.go
Normal file
18
entities/event/eventController.go
Normal file
|
@ -0,0 +1,18 @@
|
|||
package event
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
||||
func InitDB(filepath string) *sql.DB {
|
||||
db, err := sql.Open("sqlite3", filepath)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if db == nil {
|
||||
panic("db nil")
|
||||
}
|
||||
return db
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue