Documentation
¶
Overview ¶
Package devicesdb provides utilities to retrieve/update devices from db
Index ¶
- Variables
- func CountDevices(ctx context.Context, dbConn *sql.DB, filter string) (*fleetconsolerpc.CountDevicesResponse, error)
- func GetBaseDimensions(ctx context.Context, dbConn *sql.DB) (map[string]*fleetconsolerpc.LabelValues, error)
- func GetLabels(ctx context.Context, dbConn *sql.DB) (map[string]*fleetconsolerpc.LabelValues, error)
- func List(ctx context.Context, dbConn *sql.DB, filter, orderby string, ...) ([]*fleetconsolerpc.Device, bool, error)
- func ToListDevicesDevice(device *DeviceDAO) *fleetconsolerpc.Device
- type DeviceAddressDAO
- type DeviceDAO
- type DeviceMetricsDAO
- type DeviceSpecDAO
- type LabelValuesDAO
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Columns IdColumn = queryutils.NewColumn("id").Build() //nolint:stylecheck DutIdColumn = queryutils.NewColumn("dut_id").Build() //nolint:stylecheck HostColumn = queryutils.NewColumn("host").Build() PortColumn = queryutils.NewColumn("port").Build() TypeColumn = queryutils.NewColumn("type").Build() StateColumn = queryutils.NewColumn("state").Build() LabelsColumn = queryutils.NewColumn("labels").WithColumnType( queryutils.ColumnTypeJSONB).WithJSONFullPath(func(fields ...string) []string { pathComponents := []string{} pathComponents = append(pathComponents, fields...) pathComponents = append(pathComponents, "Values") return pathComponents }).Build() // Table DevicesTable = queryutils.NewTableBuilder("Devices").WithColumns( IdColumn, DutIdColumn, HostColumn, PortColumn, TypeColumn, StateColumn, LabelsColumn, ).Build() )
Functions ¶
func CountDevices ¶
func CountDevices(ctx context.Context, dbConn *sql.DB, filter string) (*fleetconsolerpc.CountDevicesResponse, error)
func GetBaseDimensions ¶
func GetBaseDimensions(ctx context.Context, dbConn *sql.DB) (map[string]*fleetconsolerpc.LabelValues, error)
GetBaseDimensions gets all the base dimensions and their possible values
func GetLabels ¶
func GetLabels(ctx context.Context, dbConn *sql.DB) (map[string]*fleetconsolerpc.LabelValues, error)
GetLabels gets all the dynamic labels and their possible values
func ToListDevicesDevice ¶
func ToListDevicesDevice(device *DeviceDAO) *fleetconsolerpc.Device
Types ¶
type DeviceAddressDAO ¶
type DeviceDAO ¶
type DeviceDAO struct { Id string //nolint:stylecheck DutId string //nolint:stylecheck Address *DeviceAddressDAO Type string State string DeviceSpec *DeviceSpecDAO }
DeviceDAO represents a device as saved in AlloyDB
func FromDeviceManagerDevice ¶
func (*DeviceDAO) DeviceAsDBArguments ¶
type DeviceMetricsDAO ¶
type DeviceSpecDAO ¶
type DeviceSpecDAO struct {
Labels map[string]*LabelValuesDAO
}
type LabelValuesDAO ¶
type LabelValuesDAO struct {
Values []string
}
Click to show internal directories.
Click to hide internal directories.