add openmct domain object table and skeleton
This commit is contained in:
parent
c9b73ee006
commit
0a6a6bb66d
36
db.go
36
db.go
|
@ -314,40 +314,18 @@ func (tdb *TelemDb) GetValues(ctx context.Context, filter BusEventFilter,
|
|||
return data, nil
|
||||
}
|
||||
|
||||
// PacketDef is a database packet model
|
||||
type PacketDef struct {
|
||||
Name string
|
||||
Description string
|
||||
Id int
|
||||
func (tdb *TelemDb) AddDocument(obj json.RawMessage) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type FieldDef struct {
|
||||
Name string
|
||||
SubName string
|
||||
Packet string
|
||||
Type string
|
||||
func (tdb *TelemDb) UpdateDocument(key string, obj json.RawMessage) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// PacketNotFoundError is when a matching packet cannot be found.
|
||||
type PacketNotFoundError string
|
||||
|
||||
func (e *PacketNotFoundError) Error() string {
|
||||
return "packet not found: " + string(*e)
|
||||
}
|
||||
|
||||
// GetPacketDefN retrieves a packet matching the given name, if it exists.
|
||||
// returns PacketNotFoundError if a matching packet could not be found.
|
||||
func (tdb *TelemDb) GetPacketDefN(name string) (*PacketDef, error) {
|
||||
func (tdb *TelemDb) GetDocument(key string) (json.RawMessage, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// GetPacketDefF retrieves the parent packet for a given field.
|
||||
// This function cannot return PacketNotFoundError since we have SQL FKs enforcing.
|
||||
func (tdb *TelemDb) GetPacketDefF(field FieldDef) (*PacketDef, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// GetFieldDefs returns the given fields for a given packet definition.
|
||||
func (tdb *TelemDb) GetFieldDefs(pkt PacketDef) ([]FieldDef, error) {
|
||||
return nil, nil
|
||||
func (tdb *TelemDb) DeleteDocument(key string) error {
|
||||
return nil
|
||||
}
|
||||
|
|
2
migrations/7_domainobject_down.sql
Normal file
2
migrations/7_domainobject_down.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
DROP TABLE openmct_objects;
|
||||
DROP INDEX openmct_key;
|
6
migrations/7_domainobject_up.sql
Normal file
6
migrations/7_domainobject_up.sql
Normal file
|
@ -0,0 +1,6 @@
|
|||
CREATE TABLE openmct_objects (
|
||||
data TEXT,
|
||||
key TEXT GENERATED ALWAYS AS (json_extract(data, '$.identifier.key')) VIRTUAL UNIQUE NOT NULL
|
||||
);
|
||||
-- fast key-lookup
|
||||
CREATE INDEX openmct_key on openmct_objects(key);
|
Loading…
Reference in a new issue