Add Database Functions

This commit is contained in:
hoernschen 2020-10-01 17:45:57 +02:00
parent 126070829c
commit 253b020733
22 changed files with 1076 additions and 119 deletions

View file

@ -1,7 +1,7 @@
package device
type Device struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Keys map[string]string `json:"keys,omitempty"`
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Keys map[string]*Key `json:"keys,omitempty"`
}

View file

@ -1,5 +1,5 @@
package device
func New() device *Device {
}
func New() (device *Device) {
return
}

7
entities/device/key.go Normal file
View file

@ -0,0 +1,7 @@
package device
type Key struct {
Id string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Key string `json:"key,omitempty"`
}

View file

@ -1,5 +1,7 @@
package event
// TODO: Check if it can be deleted
type EDU struct {
Type string `json:"type,omitempty"`
Content string `json:"content,omitempty"`

View file

@ -5,6 +5,6 @@ type Event struct {
RoomId string `json:"roomId,omitempty"`
EventType string `json:"eventType,omitempty"`
Content string `json:"content,omitempty"`
Parent string `json:"parent,omitempty"`
ParentId string `json:"parent,omitempty"`
Depth int `json:"depth,omitempty"`
}

View file

@ -1,5 +1,5 @@
package event
func New() event *Event {
}
func New() (event *Event) {
return
}

View file

@ -5,9 +5,9 @@ import (
)
type Room struct {
Id string `json:"id,omitempty"`
Messages map[string]event.Event `json:"messages,omitempty"`
State map[string]event.Event `json:"state,omitempty"`
Members []string `json:"members,omitempty"`
Version string `json:"version,omitempty"`
Id string `json:"id,omitempty"`
Messages map[string]*event.Event `json:"messages,omitempty"`
//State map[string]event.Event `json:"state,omitempty"`
Members []string `json:"members,omitempty"`
Version string `json:"version,omitempty"`
}

View file

@ -1,5 +1,5 @@
package room
func New() room *Room {
}
func New() (room *Room) {
return
}

View file

@ -5,7 +5,9 @@ import (
)
type Transaction struct {
Id string `json:"id,omitempty"`
PDUS map[string]event.Event `json:"pdus,omitempty"`
EDUS []event.EDU `json:"edus,omitempty"`
Id string `json:"id,omitempty"`
Origin string `json:"origin,omitempty"`
Timestamp int `json:"timestamp,omitempty"`
PDUS map[string]*event.Event `json:"pdus,omitempty"`
//EDUS []event.EDU `json:"edus,omitempty"`
}

View file

@ -1,5 +1,5 @@
package transaction
func New() transaction *Transaction {
}
func New() (transaction *Transaction) {
return
}

View file

@ -5,8 +5,8 @@ import (
)
type User struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Password string `json:"password,omitempty"`
Devices map[string]device.Device `json:"devices,omitempty"`
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Password string `json:"password,omitempty"`
Devices map[string]*device.Device `json:"devices,omitempty"`
}

View file

@ -1,5 +1,5 @@
package user
func New() user *User {
}
func New() (user *User) {
return
}