32 lines
935 B
Go
32 lines
935 B
Go
package models
|
|
|
|
import "github.com/google/uuid"
|
|
|
|
// Get model
|
|
type Get struct {
|
|
Uuid uuid.UUID `json:"uuid"` // universally unique identifier
|
|
Path string `json:"path"` // dbm path
|
|
Query *Query `json:"query,omitempty"` // query paramater
|
|
Drivers *Drivers `json:"drivers,omitempty"` // assigned drivers
|
|
Type Type `json:"type,omitempty"` // dbm datatype
|
|
Value any `json:"value,omitempty"` // dbm value
|
|
HasChild bool `json:"hasChild,omitempty"` // inidicates path has child/ren
|
|
Rights Rights `json:"rights,omitempty"` // dbm read /write rights
|
|
}
|
|
|
|
// search dbm datapoints by path
|
|
func (g *Get) ByPath(path string, query *Query) {
|
|
g.Path = path
|
|
if query != nil {
|
|
g.Query = query
|
|
}
|
|
}
|
|
|
|
// search dbm datapoints by uuid
|
|
func (g *Get) ByUuid(uid string, query *Query) {
|
|
g.Uuid = uuid.MustParse(uid)
|
|
if query != nil {
|
|
g.Query = query
|
|
}
|
|
}
|