location

package
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

type Location struct {
	Region     string `json:"region"`      // Geographic region
	DataCenter string `json:"data_center"` // Data center identifier
	Room       string `json:"room"`        // Room identifier
	Position   string `json:"position"`    // Specific position within room
}

Location represents location information for devices

func New

func New(b []byte) Location

New creates a Location from JSON bytes Returns a Location with "" values if unmarshaling fails

func (*Location) BuildPatchedLocation

func (loc *Location) BuildPatchedLocation(cur *Location) *Location

BuildPatchedLocation builds a patched location from the current location and the input location. It goes through the patchable fields and builds the patched location. If there is no change on patchable fields, it returns nil.

func (*Location) Encode

func (loc *Location) Encode() string

Encode serializes the Location to a JSON string. It returns "" if marshaling fails

func (*Location) ToMap

func (loc *Location) ToMap() map[string]any

ToMap converts the Location to a map[string]any, including only non-empty fields. Returns nil if loc is nil or all fields are empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL