fill model

main
Bel LaPointe 2024-04-16 05:51:08 -06:00
parent 44db0c6939
commit a7d5d021d6
4 changed files with 74 additions and 0 deletions

View File

@ -1,4 +1,30 @@
package model package model
import "time"
// EVENT ||--|{ THREAD: "spawns"
type Event struct { type Event struct {
ID string
URL string
TS uint64
Name string
Asset string
Datacenter string
Team string
Resolved bool
Updated uint64
}
func NewEvent(ID, URL string, TS uint64, Name, Asset, Datacenter, Team string, Resolved bool) Event {
return Event{
ID: ID,
URL: URL,
TS: TS,
Name: Name,
Asset: Asset,
Datacenter: Datacenter,
Team: Team,
Resolved: Resolved,
Updated: uint64(time.Now().UnixNano() / int64(time.Millisecond)),
}
} }

View File

@ -1 +1,24 @@
package model package model
import "time"
// THREAD ||--|{ MESSAGE: "populated by"
type Message struct {
ID string
URL string
TS uint64
Author string
Plaintext string
Updated uint64
}
func NewMessage(ID, URL string, TS uint64, Author, Plaintext string) Message {
return Message{
ID: ID,
URL: URL,
TS: TS,
Author: Author,
Plaintext: Plaintext,
Updated: uint64(time.Now().UnixNano() / int64(time.Millisecond)),
}
}

View File

@ -7,10 +7,12 @@ erDiagram
THREAD ||--|{ MESSAGE: "populated by" THREAD ||--|{ MESSAGE: "populated by"
MESSAGE { MESSAGE {
ID str ID str
URL str URL str
TS number TS number
Plaintext str Plaintext str
Author str
} }
THREAD { THREAD {
ID str ID str
@ -23,5 +25,6 @@ erDiagram
Asset str Asset str
Resolved bool Resolved bool
Datacenter str Datacenter str
Team str
} }
` `

View File

@ -1 +1,23 @@
package model package model
import "time"
// EVENT ||--|{ THREAD: "spawns"
// THREAD ||--|{ MESSAGE: "populated by"
type Thread struct {
ID string
URL string
TS uint64
Channel string
Updated uint64
}
func NewThread(ID, URL string, TS uint64, Channel string) Thread {
return Thread{
ID: ID,
URL: URL,
TS: TS,
Channel: Channel,
Updated: uint64(time.Now().UnixNano() / int64(time.Millisecond)),
}
}